buzz44 Posted January 31, 2005 Share Posted January 31, 2005 (edited) hello ... my script waits until a window exist and writes the date to a file .. if the window does not exist it doesnt do anything.... WinWait("AutoIt Help") FileWrite ("date.txt", @CRLF & @CRLF & "_=_=_=_=_=_" & "{" & @HOUR & ":" & @MIN & ":" & @SEC & " , " & @MDAY & "/" & @MON & "/" & @YEAR & "}" & "_=_=_=_=_=_" & @CRLF & @CRLF) While 1 If WinExists("AutoIt Help") = 0 Then Do Sleep(100) Until WinExists("AutoIt Help") = 1 Else blah EndIf WEnd every time the window exists i want it to right the date to a file ... the first time it works ok cause it wait until the window exists then writes the date ... but every other time it will right the date an infinite amount of time .. in the eg above i removed the DATE bit from the while loop... if its in the while loop it just writes hte date and infinite amount of time and i end up with sumthing like _=_=_=_=_=_{20:48:48 , 31/01/2005}_=_=_=_=_=_ _=_=_=_=_=_{20:48:49 , 31/01/2005}_=_=_=_=_=_ _=_=_=_=_=_{20:48:50 , 31/01/2005}_=_=_=_=_=_ _=_=_=_=_=_{20:48:51 , 31/01/2005}_=_=_=_=_=_ _=_=_=_=_=_{20:48:52 , 31/01/2005}_=_=_=_=_=_ any suggests? problem again : .... is there anyway i can make it save the date each time the window exists? thx Edited January 31, 2005 by burrup qq Link to comment Share on other sites More sharing options...
MHz Posted January 31, 2005 Share Posted January 31, 2005 If it needs to keep running. You may need the filewrite in the loop? WinWait("AutoIt Help") FileWrite("date.txt", @CRLF & @CRLF & "_=_=_=_=_=_" & "{" & @HOUR & ":" & @MIN & ":" & @SEC & " , " & @MDAY & "/" & @MON & "/" & @YEAR & "}" & "_=_=_=_=_=_" & @CRLF & @CRLF) While 1 If Not WinExists("AutoIt Help") Then Sleep(100) Else FileWrite("date.txt", @CRLF & @CRLF & "_=_=_=_=_=_" & "{" & @HOUR & ":" & @MIN & ":" & @SEC & " , " & @MDAY & "/" & @MON & "/" & @YEAR & "}" & "_=_=_=_=_=_" & @CRLF & @CRLF) Do Sleep(100) Until Not WinExists("AutoIt Help") EndIf WEnd Link to comment Share on other sites More sharing options...
Domonoky Posted January 31, 2005 Share Posted January 31, 2005 (edited) Hi... i dont understand your code completly.. but i think you could do something like this... (untested) $winexist=0 While 1 If (WinExists("AutoIt Help") = 1) AND ($winexist=0) Then ;window exists ;write the date into file $winexist=1 ;set marker Endif if (WinExists("AutoIt Help") = 0) Then ;windows dosnt exist $winexist=0 ;delete marker Endif sleep(100) ;sleep a bit Wend i hope i could help.. Edit: MHz was faster than me.. :-) i think his version should be better then mine :-) ..mfg Domonoky Edited January 31, 2005 by Domonoky Link to comment Share on other sites More sharing options...
buzz44 Posted January 31, 2005 Author Share Posted January 31, 2005 ahhhhh, thankyou... IT WORK GREAT thx again qq Link to comment Share on other sites More sharing options...
MHz Posted January 31, 2005 Share Posted January 31, 2005 Even replace the do until with winwaitclose. WinWait("AutoIt Help") FileWrite("date.txt", @CRLF & @CRLF & "_=_=_=_=_=_" & "{" & @HOUR & ":" & @MIN & ":" & @SEC & " , " & @MDAY & "/" & @MON & "/" & @YEAR & "}" & "_=_=_=_=_=_" & @CRLF & @CRLF) While 1 If Not WinExists("AutoIt Help") Then Sleep(100) Else FileWrite("date.txt", @CRLF & @CRLF & "_=_=_=_=_=_" & "{" & @HOUR & ":" & @MIN & ":" & @SEC & " , " & @MDAY & "/" & @MON & "/" & @YEAR & "}" & "_=_=_=_=_=_" & @CRLF & @CRLF) WinWaitClose("AutoIt Help") EndIf WEnd 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