Jump to content

Problems with WinWait and releated code


MattH
 Share

Recommended Posts

I've been using autoit for about a month and really like it. Recently, I've started writing scripts that include activating an application's window. When running the beta run in SciTe, I've noticed that eventually, WinWait, WinActive, WinExists, etc. all "think" that the application's window is still there, even though I've closed the application. The result is that even if the applciation window is open, the script doesn't execute against it. Instead, it just runs to completion as if everything is ok. Like it executed in some ghost window.

The only fix that I've found for this is to log off and back on. I can't figure out what's causing it, but it does seem that if I leave SciTe up for a while and do other work or walk away from the computer, that when I get back, this problem occurs. I'm on Vista Enterprise. Has anyone else experienced this?

Link to comment
Share on other sites

It does it with any window, even notepad. I even try using the recorder, which is what produced the code below.

#region --- ScriptWriter generated code Start ---

Opt("WinWaitDelay",100)

Opt("WinTitleMatchMode",4)

Opt("WinDetectHiddenText",1)

Opt("MouseCoordMode",0)

WinWait("Untitled - Notepad","")

If Not WinActive("Untitled - Notepad","") Then WinActivate("Untitled - Notepad","")

WinWaitActive("Untitled - Notepad","")

Send("hey")

#endregion --- ScriptWriter generated code End ---

Link to comment
Share on other sites

I can have notepad up, and it won't type hey. Also, I can close notepad, add $chk = winexists("Untitled - Notepad"), msgbox(0,"",$chk) to the script, run it, and I get a 1, meaning it found it. Log off and back on, run the same script and i get 0.

Link to comment
Share on other sites

Just trying different things, I just closed Outlook and Yahoo chat, and I'm getting a winexists = 0. I reopened these two apps and still getting the 0. Could be timing, or one of them might be cashing wintitles for fun!

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