AnAlien Posted October 22, 2014 Share Posted October 22, 2014 (edited) Hi guys, I'm new to AutoIt and from what I've read in the help file, the two functions: WinWait and WinWaitActivate WinWaitActive aren't working as described. Both of the functions link to page: https://www.autoitscript.com/autoit3/docs/intro/windowsadvanced.htm Which explains how AutoIt has 3 Windows Matching Modes: Partial Title, Substring, and Exact Match. Substring mode doesn't seem to be working for the two functions above. Can someone confirm this? I used the AutoIt Script Recorder to record mouse and keyboard actions and it recorded window title. After I changed the file name, the window title no longer matched. For example, before when I recorded it, the title was: "Filename - Program Name". Once I changed file name, exact match didn't work any more so I changed the title to only include "Program Name" so it would work for all windows in that program regardless of filename. The two functions however are not picking up the substring title and keep the script paused (because they can't detect the right window). Edited October 23, 2014 by AnAlien Link to comment Share on other sites More sharing options...
JohnOne Posted October 22, 2014 Share Posted October 22, 2014 There is no WinWaitActivate in the help file. WinWait works just fine. Run("Notepad") WinWait("Untitled") MsgBox(0,0,"Done") AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
AnAlien Posted October 23, 2014 Author Share Posted October 23, 2014 (edited) So for a window of title "Untitled - Notepad", like you said: WinWait("Untitled") works, but this doesn't: WinWait("Notepad") The Help File Says: Mode 2 Matches any substring in the title. In this mode, a window titled Untitled - Notepad would be matched by "Untitled - Notepad", "Untitled", "Notepad", "pad", etc. e.g. WinWait("Notepad") ...window titled Untitled - Notepad would be matched by "Untitled - Notepad", "Untitled", "Notepad", "pad", etc. Green works and red doesn't. Edit: Sorry for the wrong function name. I meant: WinWaitActive() not WinWaitActivate(), which is a method created by the recorder. Can a mod change the title of the thread to the appropriate function, please? Link to the method in help file: https://www.autoitscript.com/autoit3/docs/functions/WinWaitActive.htm This method, like WinWait() accepts a string for the title. In the parameters table for title, you'll see the same link to "See title special definition" which is in WinWait's page as well. Edited October 23, 2014 by AnAlien Link to comment Share on other sites More sharing options...
Solution JohnReilly54 Posted October 23, 2014 Solution Share Posted October 23, 2014 If you go to https://www.autoitscript.com/autoit3/docs/functions/AutoItSetOption.htm#WinTitleMatchMode you will see that the default value for WinTitleMatchMode is 1 not 2. Opt("WinTitleMatchMode", 1) ;1=start, 2=subStr, 3=exact, 4=advanced, -1 to -4=Nocase This is probably what is causing you to have the issue. At the top of the script you need to add Opt ("WinTitleMatchMode", 2) to get it to use that option. AnAlien 1 Link to comment Share on other sites More sharing options...
AnAlien Posted October 23, 2014 Author Share Posted October 23, 2014 Another embarrassing noob moment. Thanks John. Link to comment Share on other sites More sharing options...
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