Jump to content

WinWaitActive Problem


Recommended Posts

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 by gstroutz
Link to comment
Share on other sites

  • Moderators

Maybe I'm missing something, but those 2 statements look the same :o

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.

Link to comment
Share on other sites

$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 why

AutoItSetOption("WinTitleMatchMode", 4); allow partial title matching
edit2:

suggest AutoItSetOption("WinTitleMatchMode", 2)

Edited by herewasplato

[size="1"][font="Arial"].[u].[/u][/font][/size]

Link to comment
Share on other sites

  • Moderators

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
EndIf
I 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.

Link to comment
Share on other sites

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 by herewasplato

[size="1"][font="Arial"].[u].[/u][/font][/size]

Link to comment
Share on other sites

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

Link to comment
Share on other sites

  • Moderators

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 :o)

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.

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...