RickCHodgin2 Posted July 22, 2011 Posted July 22, 2011 Am having an issue with WinWait() and FireFox 5.0.1. AutoIt Window Info returns: "Mozilla Firefox" as part of the name, prefixed by whatever page title I'm on. I have Have this set to -2: Opt("WinTitleMatchMode", -2) ; 1=start, 2=subStr, 3=exact, 4=advanced, -1 to -4=Nocase And this code does launch Firefox (the window launches correctly and comes up): $gPID = Run( $FIREFOX_EXECUTABLE, "C:\", @SW_SHOWDEFAULT ) But this code just hangs: $gErrorTrap = WinWait( "firefox", $gTimeout ) Have tried this as well, same thing (info returned from AutoIt Window Info tool): $gErrorTrap = WinWait( "[CLASS:MozillaWindowClass]", $gTimeout ) Thanks for any help you can provide! :-) - Rick
tlman12 Posted July 22, 2011 Posted July 22, 2011 I'm unable to repoduce what your saying. could you share your code so i can see if its that or maybe its just your computer?
RickCHodgin2 Posted July 22, 2011 Author Posted July 22, 2011 (edited) I'm unable to repoduce what your saying. could you share your code so i can see if its that or maybe its just your computer? It's doing this on more than one computer in Windows 7 Home Premium and Ultimate. This code, in stand-alone script with nothing else in it, fails: Dim $gPID Dim $gErrorTrap Opt("WinTitleMatchMode", -2) $gPID = Run( "c:\program files (x86)\mozilla firefox\firefox.exe", "C:\", @SW_SHOWDEFAULT ) $gErrorTrap = WinWait( "firefox", 20 ) I don't know what else to say. Firefox launches immediately with the Run() function. The WinWait() function never sees the window. I mean, what else is there to do/try to get it to work? This code in a stand-alone script also fails: Dim $gPID Dim $gErrorTrap Opt("WinTitleMatchMode", -2) $gPID = Run( "C:\Program Files (x86)\Internet Explorer\iexplore.exe", "C:\", @SW_SHOWDEFAULT ) $gErrorTrap = WinWait( "explorer", 20 ) This code in a stand-alone script fails as well: Dim $gPID Dim $gErrorTrap Opt("WinTitleMatchMode", -2) $gPID = Run( "C:\windows\system32\notepad.exe", "C:\", @SW_SHOWDEFAULT ) $gErrorTrap = WinWait( "notepad", 20 ) I've discovered that if I remove the ",20" it works. Or if I use: $gErrorTrap = WinWait( "notepad", "", 20 ) Then it works. This seems clearly a bug in AutoIt3. [Edit: The documentation does show the timeout as being nested, as in: WinWait ( "title" [, "text" [, timeout]] ) So it may not be a literal bug in that I'm doing something not documented. But, it should recognize the numeric value of the second parameter (instead of a text parameter) and use it as a timeout... don't you think?] - Rick Edited July 22, 2011 by RickCHodgin2
tlman12 Posted July 22, 2011 Posted July 22, 2011 It's doing this on more than one computer in Windows 7 Home Premium and Ultimate. This code, in stand-alone script with nothing else in it, fails: Dim $gPID Dim $gErrorTrap Opt("WinTitleMatchMode", -2) $gPID = Run( "c:\program files (x86)\mozilla firefox\firefox.exe", "C:\", @SW_SHOWDEFAULT ) $gErrorTrap = WinWait( "firefox", 20 ) I don't know what else to say. Firefox launches immediately with the Run() function. The WinWait() function never sees the window. I mean, what else is there to do/try to get it to work? This code in a stand-alone script also fails: Dim $gPID Dim $gErrorTrap Opt("WinTitleMatchMode", -2) $gPID = Run( "C:\Program Files (x86)\Internet Explorer\iexplore.exe", "C:\", @SW_SHOWDEFAULT ) $gErrorTrap = WinWait( "explorer", 20 ) This code in a stand-alone script fails as well: Dim $gPID Dim $gErrorTrap Opt("WinTitleMatchMode", -2) $gPID = Run( "C:\windows\system32\notepad.exe", "C:\", @SW_SHOWDEFAULT ) $gErrorTrap = WinWait( "notepad", 20 ) I've discovered that if I remove the ",20" it works. Or if I use: $gErrorTrap = WinWait( "notepad", "", 20 ) Then it works. This seems clearly a bug in AutoIt3. - Rick ohh i think i see what you doing. the syntax is WinWait("Title","Text","Timeout") what you doing is putting the timeout in the Text field. so since 20 most likely isn't in the text anywhere then you can't get an exact match so it dosn't work. thats why $gErrorTrap = WinWait( "notepad", "", 20 ) cause you matching the title "notepad" and you are matching blank text with a timeout of 20
tlman12 Posted July 22, 2011 Posted July 22, 2011 [Edit: The documentation does show the timeout as being nested, as in: WinWait ( "title" [, "text" [, timeout]] ) So it may not be a literal bug in that I'm doing something not documented. But, it should recognize the numeric value of the second parameter (instead of a text parameter) and use it as a timeout... don't you think?] - Rick yes it would be nice if it did that, i think other languages do but not autoit. if you want to define an optional variable thats after another optional variable you have to define it even if it's the default value.
RickCHodgin2 Posted July 22, 2011 Author Posted July 22, 2011 yes it would be nice if it did that, i think other languages do but not autoit. if you want to define an optional variable thats after another optional variable you have to define it even if it's the default value.Thanks, tlman12. :-) Looks like the perfect job for a function wrapper.- Rick
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