gstroutz Posted March 9, 2006 Posted March 9, 2006 (edited) Has anyone noticed any problems with AutoIT's WinWaitActive command? What is weird, is I have two program which use the command multiple times. One program works fine, The other won't execute the command WinWaitActive. I've have been able to use the command WinActivate to force the program to continue, but I have not idea why the program won't work. The code is below: ;********************************************************* ; Set AutoIT operational modes Opt("MouseCoordMode", 0) ;1=absolute, 0=relative to window Opt("MustDeclareVars", 0) ;0=no, 1=require pre-declaration AutoItSetOption("WinTitleMatchMode", 4) ; allow partial title matching ; ********************************************* ; Set to run out of single directory $prog = "C:\ut\gbat\wcamp102.bat" ; Used to launch program ;***************************************************** ; If the program file exists, start running the program If FileExists($prog) Then Run($prog) Else Msgbox (1,"Program Error", " Error starting program! Exiting in 5 seconds... ", 5) Exit EndIf ;**************************************************** ; WC Argos Window $ck = WinWaitActive ("WC Argos",5) if $ck > 0 Then MouseClick ("Left", 16, 39, 1, 5) ; File MouseClick ("Left", 26, 59, 1, 5) ; Open EndIf ; Currently will not execute on this window when the program launches ; However, the following will! $ck = WinActivate ("WC Argos",5) if $ck > 0 Then MouseClick ("Left", 16, 39, 1, 5) ; File MouseClick ("Left", 26, 59, 1, 5) ; Open EndIf Edited March 9, 2006 by gstroutz
Moderators SmOke_N Posted March 9, 2006 Moderators Posted March 9, 2006 Maybe I'm missing something, but those 2 statements look the same Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.
herewasplato Posted March 9, 2006 Posted March 9, 2006 (edited) $ck = WinWaitActivate ("WC Argos",5) no such function edit: if the OP meant WinActivate as mentioned:...WinActivate to force the program to continue...then the syntax is in error: WinActivate ( "title" [, "text"] ) there is no timeout parm and whyAutoItSetOption("WinTitleMatchMode", 4); allow partial title matchingedit2: suggest AutoItSetOption("WinTitleMatchMode", 2) Edited March 9, 2006 by herewasplato [size="1"][font="Arial"].[u].[/u][/font][/size]
gstroutz Posted March 9, 2006 Author Posted March 9, 2006 Sorry - typo in first round. I editted it to reflect reality. -g
Moderators SmOke_N Posted March 9, 2006 Moderators Posted March 9, 2006 Derrr.... Man I need to wake up! WinWait("WC Argos", 5) If WinExists('WC Argos') Then If Not WinActive('WC Argos') Then WinActivate('WC Argos') WinWaitActive('WC Argos') If $ck > 0 Then MouseClick ("Left", 16, 39, 1, 5); File MouseClick ("Left", 26, 59, 1, 5); Open EndIf EndIfI don't know... Try this and see what happens. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.
herewasplato Posted March 9, 2006 Posted March 9, 2006 (edited) or try:WinWait("WC Argos", 5) If WinExists('WC Argos') Then If Not WinActive('WC Argos') Then WinActivate('WC Argos') If WinWaitActive('WC Argos') > 0 Then MouseClick("Left", 16, 39, 1, 5); File MouseClick("Left", 26, 59, 1, 5); Open EndIf EndIf @SmOke_N, I did not see where you set $ck sleep... sleep.... Edited March 9, 2006 by herewasplato [size="1"][font="Arial"].[u].[/u][/font][/size]
gstroutz Posted March 9, 2006 Author Posted March 9, 2006 No - I get the same result. However, this works just fine, Run("Notepad.exe","",) WinWaitActive("Untitled","",5) Send("This is a test {ENTER}") So I do not think AutoIt is the problem. Thanks for the suggestions, though. -G
Moderators SmOke_N Posted March 9, 2006 Moderators Posted March 9, 2006 or try:WinWait("WC Argos", 5) If WinExists('WC Argos') Then If Not WinActive('WC Argos') Then WinActivate('WC Argos') If WinWaitActive('WC Argos') > 0 Then MouseClick("Left", 16, 39, 1, 5); File MouseClick("Left", 26, 59, 1, 5); Open EndIf EndIf @SmOke_N, I did not see where you set $ck sleep... sleep....I thought maybe he had pre defined $ck in a global or something... didn't want to assume it was for WinWaitActive(). (Instead of sleep... sleep... should be wake up ... wake up ) Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now