Page 1 of 1 1
Topic Options
#87047 - 2002-07-26 09:03 AM AutoItX COM
punkie Offline
Getting the hang of it

Registered: 2002-06-23
Posts: 67
I need some advice on how to use the AutoItX, the following code seems to confuse Kix...

code:
select
case @WDayNo = "1" $day = "Sun"
case @WDayNo = "2" $day = "Mon"
case @WDayNo = "3" $day = "Tue"
case @WDayNo = "4" $day = "Wed"
case @WDayNo = "5" $day = "Thu"
case @WDayNo = "6" $day = "Fri"
case @WDayNo = "7" $day = "Sat"
endselect

$objAutoIt = CreateObject("AutoItX.Control")
$getwindow = $objAutoIt.WinWaitActivate("Untitled - Notepad","",5)
$sendkeys = $objAutoIt.Send("$day @MDayNo @Time -- hello world{ENTER}")
sleep 5

It results in the error:
Script error: expected expression!
$getwindow = $objAutoIt.WinWaitActivate("Untitled - Notepad","",5)

But the following code seem to work, unfortunately I can't control the program like I want using this because I want to get the windows text. Also I wouldn't want to use it directly through an AutoIt script, I prefer using dlls.

code:
$objWScript = CreateObject("WScript.Shell")
$objAutoIt = CreateObject("AutoItX.Control")
$getwindow = $objWScript.AppActivate("Untitled - Notepad")
$sendkeys = $objAutoIt.Send("$day @MDayNo @Time -- hello world{ENTER}")
sleep 5


Top
#87048 - 2002-07-26 01:40 PM Re: AutoItX COM
Chris S. Offline
MM club member
*****

Registered: 2002-03-18
Posts: 2368
Loc: Earth
Try changing this...

$getwindow = $objAutoIt.WinWaitActivate("Untitled - Notepad","",5)

to this...

$getwindow = $objAutoIt.WinWaitActivate("Untitled - Notepad",,5)

Top
#87049 - 2002-07-26 01:54 PM Re: AutoItX COM
punkie Offline
Getting the hang of it

Registered: 2002-06-23
Posts: 67
I still get same error for some reason.
Any other ideas?

Top
#87050 - 2002-07-26 02:01 PM Re: AutoItX COM
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
also you may do the same with kix's setfocus-function.
_________________________
!

download KiXnet

Top
#87051 - 2002-07-26 02:39 PM Re: AutoItX COM
Chris S. Offline
MM club member
*****

Registered: 2002-03-18
Posts: 2368
Loc: Earth
My first post was from home, so I didn't try out your code. I found the problem...

code:
;$getwindow = $objAutoIt.WinWaitActivate ("Untitled - Notepad","",5)
$getwindow = $objAutoIt.WinWaitActive ("Untitled - Notepad","",5)



[ 26 July 2002, 14:39: Message edited by: Chris S. ]

Top
#87052 - 2002-07-26 03:04 PM Re: AutoItX COM
punkie Offline
Getting the hang of it

Registered: 2002-06-23
Posts: 67
Thanks for your help Chris, it works now [Smile]
I knew it was something simple...

Top
#87053 - 2002-07-26 03:12 PM Re: AutoItX COM
Chris S. Offline
MM club member
*****

Registered: 2002-03-18
Posts: 2368
Loc: Earth
Personally, I think its annoying how programming/scripting languages insist on you spelling the commands correctly. [Wink] [Big Grin]
Top
Page 1 of 1 1


Moderator:  Shawn, ShaneEP, Ruud van Velsen, Arend_, Jochen, Radimus, Glenn Barnas, Allen, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 2220 anonymous users online.
Newest Members
Viginette, ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder
17888 Registered Users

Generated in 0.064 seconds in which 0.033 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org