Docfxit Posted October 10, 2007 Share Posted October 10, 2007 I'm having a couple problems with this script. 1. The script runs a function at AdlibEnable("_resetStartTime", 250) line 80 that executes a command "If WinExists($strTitle)" line 142. When it's running it finds the title even though there is no window with that title or part in the title. If I run it in the Debugger it doesn't find the title and it runs like it should. What would cause it to falsely find the title? 2. When I press the "HotKeySet("!^x", "ExitKill") ; Ctrl+Alt+X" it doesn't kill the script. It's because it's not in the Do loop. Do you have any better ideas on how to kill the script? expandcollapse popup#include <date.au3> #include <array.au3> #include <GUIConstants.au3> #Include <GuiCombo.au3> ;DadSoft.exe "name of app" "hours allowed" ;When you start it, it asks for the name of the application to track (pull down list or type in partial name), and how many hours per day you want it allowed. ;At the end of those hours there is a warning and the app closes. The next day, X more hours are allocated and so on. ;If you enter a fractional hour (e.g. .1) the monitored app will run for only .1 hour or 6 minutes. ;If you un-remark the tooltip lines you can see what is going on with the variables (debugging)... ;command line parameters for running from HKLM-Software-Microsoft-Windows-Run or from batch file... ; Credit for writing this goes to > http://www.autoitscript.com/forum/index.php?showtopic=28174&st=0&p=199930&#entry199930 $g_szVersion = "Rules" $day = _DateToDayValue(@YEAR, @MON, @MDAY) If WinExists($g_szVersion) Then Exit AutoItWinSetTitle($g_szVersion) Opt("TrayIconHide", 1) Opt("TrayIconDebug", 1) HotKeySet("!^x", "ExitKill") ;Sets the hot key combination to Ctrl+Alt+X Dim $on = 1 ;Variable says the program is running Global $strTitle = "Untitled" Dim $strApplication = "Application" Dim $timeAllowed = 480000 ; enter milliseconds (e.g. 30 seconds = 30000 milliseconds) Dim $timeElapsed = 0 Dim $timeStarted = 0 Dim $state = "Not running" Global $timeAllowedHours = $timeAllowed / 3600000 Dim $var[5][5], $run, $AppList, $GetTimeAllowed ;MsgBox(1, "Command line parameters?", $cmdline[0]) If $cmdline[0] = 2 Then MsgBox(1, "Command line parameters?", $cmdline[1]) MsgBox(1, "Command line parameters?", $cmdline[2]) $strTitle = Execute($cmdline[1]) $timeAllowedHours = $cmdline[2] Else $w = 575 $h = 110 GUICreate("Rules", $w, $h, @DesktopWidth / 2 - $w / 2, @DesktopHeight / 2 - $h / 2) ; $var = WinList() ; $var = "Myspace" ; _ArrayDisplay($var, "$var") GUISetFont(12, 500) $AppList = GUICtrlCreateCombo("Choose the application to block (pull down list)", 10, 10, 550, 50, BitOR($CBS_DROPDOWN, $CBS_AUTOHSCROLL, $WS_VSCROLL)) ; create first item For $i = 1 To $var[0][0] ; Only display visble windows that have a title If $var[$i][0] <> "" And IsVisible($var[$i][1]) And $var[$i][0] <> "Program Manager" Then _GUICtrlComboAddString($AppList, $var[$i][0]) MsgBox(0, "Details", "Title=" & $var[$i][0] & @LF & "Handle=" & $var[$i][1]) EndIf Next GUISetFont(24, 1) $lblHours = GUICtrlCreateLabel("Hours allowed:", 10, 60, 250, 30) $GetTimeAllowed = GUICtrlCreateInput("1", 260, 60, 75, 40) $updown = GUICtrlCreateUpdown($GetTimeAllowed) $run = GUICtrlCreateButton("Run", 480, 60, 80, 40) GUISetState(@SW_SHOW) EndIf While 1 $msg = GUIGetMsg() Opt("WinTitleMatchMode", 2) Select Case $msg = $GUI_EVENT_CLOSE Exit Case $msg = $run Or $cmdline[0] <> 0 GUISetState(@SW_HIDE) If $cmdline[0] = "" Then $strTitle = GUICtrlRead($AppList) $timeAllowedHours = GUICtrlRead($GetTimeAllowed) Else $strTitle = $cmdline[1] $timeAllowedHours = $cmdline[2] EndIf ;MsgBox(1,"$AppList",GUICtrlRead($AppList)) ;MsgBox(1,"$GetTimeAllowed",GUICtrlRead($GetTimeAllowed)) AdlibEnable("_resetStartTime", 250) Do ;;;;;;;;;;;;;;;; get started Sleep(1000) If WinExists(Execute($strTitle)) And $day = _DateToDayValue(@YEAR, @MON, @MDAY) And $timeElapsed = 0 Then ;MsgBox(1,"Got here","2",1) $timeStarted = @HOUR + (@MIN / 60) ;MsgBox(1,"$timestarted",@HOUR + (@MIN/60),1) $timeElapsed = ((@HOUR + (@MIN / 60)) + .0001) - $timeStarted $restart = 0 EndIf Sleep(1000) ;;;;;;;;;;;; what to do while time hasn't run out If WinExists(Execute($strTitle)) And $day = _DateToDayValue(@YEAR, @MON, @MDAY) And $timeElapsed < $timeAllowedHours Then ;MsgBox(1,"Got here","3",1) $timeElapsed = ((@HOUR + (@MIN / 60)) + .0001) - $timeStarted EndIf Sleep(1000) ;;;;;;;;;;;;;;; what to do when time runs out ;MsgBox(1,"Does WinTitle exist?",WinExists(execute($strTitle)) & " : " & $strTitle) If WinExists(Execute($strTitle)) And $day = _DateToDayValue(@YEAR, @MON, @MDAY) And $timeElapsed > $timeAllowedHours Then ;MsgBox(1,"Got here","5",1) ToolTip($strApplication & ": " & $state & @CRLF & "Current time: " & @HOUR + (@MIN / 60) & @CRLF & "Time started: " & $timeStarted & @CRLF & "Minutes elapsed: " & $timeElapsed * 60 & @CRLF & "Minutes allowed: " & $timeAllowedHours * 60 & @CRLF & "Minutes left: " & ($timeAllowedHours - $timeElapsed) * 60 & @CRLF & "Day: " & $day, 750, 100, "Rules Warning") MsgBox(1, "Warning", "Your " & $timeAllowedHours & " hours for using " & $strApplication & " has run out...", 10) Sleep(3000) MsgBox(1, "End", $strApplication & " will now close.", 5) WinClose($strTitle) EndIf Sleep(1000) ;MsgBox(1,"Got here","7",2) If WinExists(Execute($strTitle)) Then $state = "Running" Else $state = "Not running" EndIf Sleep(1000) ToolTip($strApplication & ": " & $state & @CRLF & "Current time: " & @HOUR + (@MIN / 60) & @CRLF & "Time started: " & $timeStarted & @CRLF & "Minutes elapsed: " & $timeElapsed * 60 & @CRLF & "Minutes allowed: " & $timeAllowedHours * 60 & @CRLF & "Minutes left: " & ($timeAllowedHours - $timeElapsed) * 60 & @CRLF & "Day: " & $day, 750, 100, "Rules Warning") Sleep(4000) If $day < _DateToDayValue(@YEAR, @MON, @MDAY) Then $day = _DateToDayValue(@YEAR, @MON, @MDAY) MsgBox(1, "_dateToDayValue(YMD)", _DateToDayValue(@YEAR, @MON, @MDAY)) $timeElapsed = 0 EndIf Until $on = 0 ;Repeat this process until the program is turned off ToolTip("") EndSelect WEnd Func ExitKill() ;When the hot key combination is pressed $on = 0 ;Turn the program off EndFunc ;==>ExitKill Func _resetStartTime() If WinExists($strTitle) = 0 And $timeElapsed = 0 Then ToolTip($strTitle & ": " & $state & @CRLF & "Current time: " & @HOUR + (@MIN / 60) & @CRLF & "Time started: " & $timeStarted & @CRLF & "Minutes elapsed: " & $timeElapsed * 60 & @CRLF & "Minutes allowed: " & $timeAllowedHours * 60 & @CRLF & "Minutes left: " & ($timeAllowedHours - $timeElapsed) * 60 & @CRLF & "Day: " & $day, 750, 100, "Rules Warning") MsgBox(1,"Does WinTitle exist? @Line144",WinExists(execute($strTitle)) & " : " & $strTitle) WinWait($strTitle) $timeStarted = (@HOUR + (@MIN / 60)) $timeElapsed = .0001 ElseIf WinExists($strTitle) = 0 And $timeElapsed <> 0 Then ToolTip($strTitle & ": " & $state & @CRLF & "Current time: " & @HOUR + (@MIN / 60) & @CRLF & "Time started: " & $timeStarted & @CRLF & "Minutes elapsed: " & $timeElapsed * 60 & @CRLF & "Minutes allowed: " & $timeAllowedHours * 60 & @CRLF & "Minutes left: " & ($timeAllowedHours - $timeElapsed) * 60 & @CRLF & "Day: " & $day, 750, 100, "Rules Warning") WinWait($strTitle) $timeStarted = (@HOUR + (@MIN / 60)) - $timeElapsed EndIf EndFunc ;==>_resetStartTime Func IsVisible($handle) If BitAND(WinGetState($handle), 2) Then Return 1 Else Return 0 EndIf EndFunc ;==>IsVisible Thank you, Docfxit Link to comment Share on other sites More sharing options...
Docfxit Posted October 11, 2007 Author Share Posted October 11, 2007 Hi, I have reduced the code to show that WinExists is finding a title that doesn't exist. How could that happen? #include <date.au3> $day = _DateToDayValue(@YEAR, @MON, @MDAY) Global $strTitle = "This doesn't exist" Dim $timeElapsed = 0 Dim $state = "Not running" Dim $timeStarted = 0 Dim $timeAllowed = 480000 ; enter milliseconds (e.g. 30 seconds = 30000 milliseconds) Global $timeAllowedHours = $timeAllowed / 3600000 AdlibEnable("_resetStartTime", 250) Func _resetStartTime() If WinExists($strTitle) = 0 And $timeElapsed = 0 Then ToolTip($strTitle & ": " & $state & @CRLF & "Current time: " & @HOUR + (@MIN / 60) & @CRLF & "Time started: " & $timeStarted & @CRLF & "Minutes elapsed: " & $timeElapsed * 60 & @CRLF & "Minutes allowed: " & $timeAllowedHours * 60 & @CRLF & "Minutes left: " & ($timeAllowedHours - $timeElapsed) * 60 & @CRLF & "Day: " & $day, 750, 100, "Rules Warning") MsgBox(1, "Does WinTitle exist? @Line144", WinExists(Execute($strTitle)) & " : " & $strTitle) WinWait($strTitle) $timeStarted = (@HOUR + (@MIN / 60)) $timeElapsed = .0001 ElseIf WinExists($strTitle) = 0 And $timeElapsed <> 0 Then ToolTip($strTitle & ": " & $state & @CRLF & "Current time: " & @HOUR + (@MIN / 60) & @CRLF & "Time started: " & $timeStarted & @CRLF & "Minutes elapsed: " & $timeElapsed * 60 & @CRLF & "Minutes allowed: " & $timeAllowedHours * 60 & @CRLF & "Minutes left: " & ($timeAllowedHours - $timeElapsed) * 60 & @CRLF & "Day: " & $day, 750, 100, "Rules Warning") WinWait($strTitle) $timeStarted = (@HOUR + (@MIN / 60)) - $timeElapsed EndIf EndFunc ;==>_resetStartTime Thank you, Docfxit Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted October 11, 2007 Moderators Share Posted October 11, 2007 Hi, I have reduced the code to show that WinExists is finding a title that doesn't exist. How could that happen? #include <date.au3> $day = _DateToDayValue(@YEAR, @MON, @MDAY) Global $strTitle = "This doesn't exist" Dim $timeElapsed = 0 Dim $state = "Not running" Dim $timeStarted = 0 Dim $timeAllowed = 480000 ; enter milliseconds (e.g. 30 seconds = 30000 milliseconds) Global $timeAllowedHours = $timeAllowed / 3600000 AdlibEnable("_resetStartTime", 250) Func _resetStartTime() If WinExists($strTitle) = 0 And $timeElapsed = 0 Then ToolTip($strTitle & ": " & $state & @CRLF & "Current time: " & @HOUR + (@MIN / 60) & @CRLF & "Time started: " & $timeStarted & @CRLF & "Minutes elapsed: " & $timeElapsed * 60 & @CRLF & "Minutes allowed: " & $timeAllowedHours * 60 & @CRLF & "Minutes left: " & ($timeAllowedHours - $timeElapsed) * 60 & @CRLF & "Day: " & $day, 750, 100, "Rules Warning") MsgBox(1, "Does WinTitle exist? @Line144", WinExists(Execute($strTitle)) & " : " & $strTitle) WinWait($strTitle) $timeStarted = (@HOUR + (@MIN / 60)) $timeElapsed = .0001 ElseIf WinExists($strTitle) = 0 And $timeElapsed <> 0 Then ToolTip($strTitle & ": " & $state & @CRLF & "Current time: " & @HOUR + (@MIN / 60) & @CRLF & "Time started: " & $timeStarted & @CRLF & "Minutes elapsed: " & $timeElapsed * 60 & @CRLF & "Minutes allowed: " & $timeAllowedHours * 60 & @CRLF & "Minutes left: " & ($timeAllowedHours - $timeElapsed) * 60 & @CRLF & "Day: " & $day, 750, 100, "Rules Warning") WinWait($strTitle) $timeStarted = (@HOUR + (@MIN / 60)) - $timeElapsed EndIf EndFunc ;==>_resetStartTime Thank you, DocfxitWhat are you proving here? You have: If WinExists($strTitle) = 0 And $timeElapsed = 0 Then Well, = 0 means ... "Does "Not"" exist. I don't see anything wrong with what it's doing. 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 More sharing options...
Docfxit Posted October 11, 2007 Author Share Posted October 11, 2007 What are you proving here? You have:If WinExists($strTitle) = 0 And $timeElapsed = 0 ThenWell, = 0 means ... "Does "Not"" exist.I don't see anything wrong with what it's doing.WinExists($strTitle) is only supposed to be true if the window exists. It doesn't exists. This should go into a loop until the window does exists.Thank you,Docfxit Link to comment Share on other sites More sharing options...
PsaltyDS Posted October 11, 2007 Share Posted October 11, 2007 WinExists($strTitle) is only supposed to be true if the window exists. It doesn't exists. This should go into a loop until the window does exists.Thank you,DocfxitWinExists() is returning False, which is 0. Now insert that into your code and you get:If False = 0 ...- or - If 0 = 0That compare is True... time for more caffine... Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted October 11, 2007 Moderators Share Posted October 11, 2007 WinExists($strTitle) is only supposed to be true if the window exists. It doesn't exists. This should go into a loop until the window does exists. Thank you, DocfxitWhat loop? Your asking how "WinExists()" is finding a title that doesn't exist... It's not. You've made your statement: If WinExists($strTitle) = 0 Then It's the same as If Not WinExists($strTitle) Then Fix your code to say: #include <date.au3> $day = _DateToDayValue(@YEAR, @MON, @MDAY) Global $strTitle = "This doesn't exist" Dim $timeElapsed = 0 Dim $state = "Not running" Dim $timeStarted = 0 Dim $timeAllowed = 480000 ; enter milliseconds (e.g. 30 seconds = 30000 milliseconds) Global $timeAllowedHours = $timeAllowed / 3600000 AdlibEnable("_resetStartTime", 250) Func _resetStartTime() If WinExists($strTitle) And $timeElapsed = 0 Then;Removed = 0 from WinExist ToolTip($strTitle & ": " & $state & @CRLF & "Current time: " & @HOUR + (@MIN / 60) & @CRLF & "Time started: " & $timeStarted & @CRLF & "Minutes elapsed: " & $timeElapsed * 60 & @CRLF & "Minutes allowed: " & $timeAllowedHours * 60 & @CRLF & "Minutes left: " & ($timeAllowedHours - $timeElapsed) * 60 & @CRLF & "Day: " & $day, 750, 100, "Rules Warning") MsgBox(1, "Does WinTitle exist? @Line144", WinExists(Execute($strTitle)) & " : " & $strTitle) WinWait($strTitle) $timeStarted = (@HOUR + (@MIN / 60)) $timeElapsed = .0001 ElseIf WinExists($strTitle) And $timeElapsed <> 0 Then;Removed = 0 from WinExist ToolTip($strTitle & ": " & $state & @CRLF & "Current time: " & @HOUR + (@MIN / 60) & @CRLF & "Time started: " & $timeStarted & @CRLF & "Minutes elapsed: " & $timeElapsed * 60 & @CRLF & "Minutes allowed: " & $timeAllowedHours * 60 & @CRLF & "Minutes left: " & ($timeAllowedHours - $timeElapsed) * 60 & @CRLF & "Day: " & $day, 750, 100, "Rules Warning") WinWait($strTitle) $timeStarted = (@HOUR + (@MIN / 60)) - $timeElapsed EndIf EndFunc ;==>_resetStartTimeNow you can see if it goes inside the conditional statement. 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 More sharing options...
aslani Posted October 11, 2007 Share Posted October 11, 2007 I personally don't like putting conditions inside a function unless the condition is part of a calculation. I would do something like this instead; If Not WinExists($strTitle) Then If $timeElapse = 0 Then _resetStartTime() ElseIf $timeElapse <> 0 Then _resetStartTime($timeElapse) EndIf EndIf Func _resetStartTime($t_elapsed = 0) $timeStarted = (@HOUR + (@MIN / 60)) - $t_elapsed EndFunc [font="Georgia"]Chances are, I'm wrong.[/font]HotKey trouble?Stringregexp GuideAutoIT Current Version Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted October 11, 2007 Moderators Share Posted October 11, 2007 I personally don't like putting conditions inside a function unless the condition is part of a calculation. I would do something like this instead; If Not WinExists($strTitle) Then If $timeElapse = 0 Then _resetStartTime() ElseIf $timeElapse <> 0 Then _resetStartTime($timeElapse) EndIf EndIf Func _resetStartTime($t_elapsed = 0) $timeStarted = (@HOUR + (@MIN / 60)) - $t_elapsed EndFuncHe's using AdlibEnable... Guess you missed that part? 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 More sharing options...
Docfxit Posted October 11, 2007 Author Share Posted October 11, 2007 Thank you very much for the suggestion. I have added a Msgbox at the beginning of the function. It never comes up when I run this in SciTE. When I run this in the Debugger it runs fine. I am running AutoIt ver. 3.2.8.2 and beta ver. 3.2.9.3 Thank you, Docfxit What loop? Your asking how "WinExists()" is finding a title that doesn't exist... It's not. You've made your statement: If WinExists($strTitle) = 0 Then It's the same as If Not WinExists($strTitle) Then Fix your code to say: #include <date.au3> $day = _DateToDayValue(@YEAR, @MON, @MDAY) Global $strTitle = "This doesn't exist" Dim $timeElapsed = 0 Dim $state = "Not running" Dim $timeStarted = 0 Dim $timeAllowed = 480000 ; enter milliseconds (e.g. 30 seconds = 30000 milliseconds) Global $timeAllowedHours = $timeAllowed / 3600000 AdlibEnable("_resetStartTime", 250) Func _resetStartTime() MsgBox(1, "This is happening", "Title : " & $strTitle) ; I added this line and it's not coming up. If WinExists($strTitle) And $timeElapsed = 0 Then;Removed = 0 from WinExist ToolTip($strTitle & ": " & $state & @CRLF & "Current time: " & @HOUR + (@MIN / 60) & @CRLF & "Time started: " & $timeStarted & @CRLF & "Minutes elapsed: " & $timeElapsed * 60 & @CRLF & "Minutes allowed: " & $timeAllowedHours * 60 & @CRLF & "Minutes left: " & ($timeAllowedHours - $timeElapsed) * 60 & @CRLF & "Day: " & $day, 750, 100, "Rules Warning") MsgBox(1, "Does WinTitle exist? @Line144", WinExists(Execute($strTitle)) & " : " & $strTitle) WinWait($strTitle) $timeStarted = (@HOUR + (@MIN / 60)) $timeElapsed = .0001 ElseIf WinExists($strTitle) And $timeElapsed <> 0 Then;Removed = 0 from WinExist ToolTip($strTitle & ": " & $state & @CRLF & "Current time: " & @HOUR + (@MIN / 60) & @CRLF & "Time started: " & $timeStarted & @CRLF & "Minutes elapsed: " & $timeElapsed * 60 & @CRLF & "Minutes allowed: " & $timeAllowedHours * 60 & @CRLF & "Minutes left: " & ($timeAllowedHours - $timeElapsed) * 60 & @CRLF & "Day: " & $day, 750, 100, "Rules Warning") WinWait($strTitle) $timeStarted = (@HOUR + (@MIN / 60)) - $timeElapsed EndIf EndFunc ;==>_resetStartTimeNow you can see if it goes inside the conditional statement. Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted October 11, 2007 Moderators Share Posted October 11, 2007 That's an issue with AdlibEnable() but it works fine with both those versions for me in SciTE and compiled. 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 More sharing options...
aslani Posted October 11, 2007 Share Posted October 11, 2007 He's using AdlibEnable... Guess you missed that part?I saw that, but the only real calculation in his function is this "$timeStarted = (@HOUR + (@MIN / 60)) - $timeElapsed".I always screw myself up when I start adding unnessary conditions in my function too, I'm merely suggesting another way of doing it, where he can loop the condition rather than the function. That's all. [font="Georgia"]Chances are, I'm wrong.[/font]HotKey trouble?Stringregexp GuideAutoIT Current Version Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted October 11, 2007 Moderators Share Posted October 11, 2007 I saw that, but the only real calculation in his function is this "$timeStarted = (@HOUR + (@MIN / 60)) - $timeElapsed".I always screw myself up when I start adding unnessary conditions in my function too, I'm merely suggesting another way of doing it, where he can loop the condition rather than the function. That's all.Yeah, but you can't have parameters in your functions with AdlibeEnable()... that's what I was pointing out. 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 More sharing options...
aslani Posted October 11, 2007 Share Posted October 11, 2007 Yeah, but you can't have parameters in your functions with AdlibeEnable()... that's what I was pointing out.And I wasn't replying about AdlibEnable(). I was only replying about how he structured his function and was simply making a suggestion. [font="Georgia"]Chances are, I'm wrong.[/font]HotKey trouble?Stringregexp GuideAutoIT Current Version Link to comment Share on other sites More sharing options...
Docfxit Posted October 11, 2007 Author Share Posted October 11, 2007 I personally don't like putting conditions inside a function unless the condition is part of a calculation. I would do something like this instead; If Not WinExists($strTitle) Then If $timeElapse = 0 Then _resetStartTime() ElseIf $timeElapse <> 0 Then _resetStartTime($timeElapse) EndIf EndIf Func _resetStartTime($t_elapsed = 0) $timeStarted = (@HOUR + (@MIN / 60)) - $t_elapsed EndFunc Thank you for the suggestion. I guess this would have to go into a While loop to keep looking for the window. It's supposed to run the function when the window does exist so I think the "Not" needs to be removed. When would I know the window doesn't exist so I can stop the loop? Thank you, Docfxit Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted October 11, 2007 Moderators Share Posted October 11, 2007 Ha... I understand now ... I thought you were using pseudo code... and I stuck a: While 1 Sleep(1000000) WEndIn there just to see if it was working... I had no idea you weren't actually using a loop to keep the script running... so it never even made it to the 250 millisecond adlib. 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 More sharing options...
aslani Posted October 11, 2007 Share Posted October 11, 2007 Thank you for the suggestion. I guess this would have to go into a While loop to keep looking for the window. It's supposed to run the function when the window does exist so I think the "Not" needs to be removed. When would I know the window doesn't exist so I can stop the loop? Thank you, Docfxit I would do something like this (using my suggestion); If WinExists($strTitle) Then ;removed Not :) If $timeElapse = 0 Then _resetStartTime() ElseIf $timeElapse <> 0 Then _resetStartTime($timeElapse) EndIf ElseIf Not WinExists($strTitle) Then ExitLoop EndIf [font="Georgia"]Chances are, I'm wrong.[/font]HotKey trouble?Stringregexp GuideAutoIT Current Version 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