shaggy Posted July 26, 2005 Share Posted July 26, 2005 From helpfile:Function ReferenceWinWaitActive ( "title", ["text"], [timeout] )Return Value Success: Returns 1. Failure: Returns 0 if timeout occurred. but it doesn't work!I need to trace windows with changing header. For example, Windows Explorer and ACDSee header may be "test" or "C:\test" on difference computers. It depends on program option, that users can change. (Its easy with RegExp, but i didn't found it in AutoIt3). So i start explorer c:\test and use WinWaitActive("C:\test", "", 10) before other actions. BUT, in case of WinWaitActive timeout, i need to check for windows with name "test", that is Explorer, too. And i can't do it, because i always get @error = 0.You can check it with this script (folder C:\test needs to be created):Run("explorer.exe /e,c:\test") WinWaitActive("C:\test", "", 10) If @error = 0 Then MsgBox(0, "1:exit with", @error) Else MsgBox(0, "2:exit with", @error) EndIfRun this script, then in WinWaitActive change C:\test on any not existing folder. In both cases you'll see: 1:exit with 0I only may be wrong, if return value is not placed in @error. But where?AutoIt v 3.1.1.0 April 7th 2005System windows xp sp2 Link to comment Share on other sites More sharing options...
GaryFrost Posted July 26, 2005 Share Posted July 26, 2005 Opt("WinTitleMatchMode",2) Run("explorer.exe /e,c:\test") $ret = WinWaitActive("test", "", 10) If $ret = 0 Then MsgBox(0, "1:exit with", $ret) Else MsgBox(0, "2:exit with", $ret) EndIf SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
herewasplato Posted July 26, 2005 Share Posted July 26, 2005 Use Gary's code for this need.It will match a substring within a title as you requested.As for RegExp, see this post:http://www.autoitscript.com/forum/index.ph...964entry92964As for the "bug" - try this code:Run("explorer.exe /e,c:\test") $var = WinWaitActive("C:\test", "", 10) If $var = 1 Then MsgBox(0, "Success: Returns 1. ", $var) Else MsgBox(0, "Failure: Returns 0 if timeout occurred. ", $var) EndIflater.... [size="1"][font="Arial"].[u].[/u][/font][/size] 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