zxzxzx Posted February 26, 2009 Share Posted February 26, 2009 This is my script While 1 If WinExists('Untitled') Then MsgBox(0, '1', 'Once') EndIf WEnd I want it in loop but i want when Untitled appear, it will do MsgBox once. I can't Can you help me or give script? Thanks Link to comment Share on other sites More sharing options...
SpookMeister Posted February 26, 2009 Share Posted February 26, 2009 While 1 If WinExists('Untitled') Then MsgBox(0, '1', 'Once') ExitLoop EndIf WEnd [u]Helpful tips:[/u]If you want better answers to your questions, take the time to reproduce your issue in a small "stand alone" example script whenever possible. Also, make sure you tell us 1) what you tried, 2) what you expected to happen, and 3) what happened instead.[u]Useful links:[/u]BrettF's update to LxP's "How to AutoIt" pdfValuater's Autoit 1-2-3 Download page for the latest versions of Autoit and SciTE[quote]<glyph> For example - if you came in here asking "how do I use a jackhammer" we might ask "why do you need to use a jackhammer"<glyph> If the answer to the latter question is "to knock my grandmother's head off to let out the evil spirits that gave her cancer", then maybe the problem is actually unrelated to jackhammers[/quote] Link to comment Share on other sites More sharing options...
EndFunc Posted February 26, 2009 Share Posted February 26, 2009 This is my script While 1 If WinExists('Untitled') Then MsgBox(0, '1', 'Once') EndIf WEndoÝ÷ ØØyh¢î¶,Ü!zu'¶+eyÖ©¥æ«Ü"Wh2È£'qâj}ý´&§Ê¡zZfzà÷¬r¸©µ8ZK?ªê-y'ûaÌ(®K¢¼¨¹«¢+Ù]¡¥±Ä()%]¥¹á¥ÍÑÌ ÌäíU¹Ñ¥Ñ±Ìäì¤Q¡¸(5Í ½à À°ÌäìÄÌäì°Ìäí=¹Ìäì¤(á¥Ñ1½½À)¹%()]¹ EndFuncAutoIt is the shiznit. I love it. Link to comment Share on other sites More sharing options...
isolation Posted February 26, 2009 Share Posted February 26, 2009 AdlibEnable("ceck") Func ceck() If WinExists('Untitled') Then MsgBox(0, '1', 'Once') adlibdisable() endif endfunc Link to comment Share on other sites More sharing options...
Inverted Posted February 26, 2009 Share Posted February 26, 2009 $window_found_firsttime = 0 While 1 If WinExists('Untitled') AND $window_found_firsttime = 0 Then $window_found_firsttime = 1 MsgBox(0, '1', 'Once') EndIf WEnd Link to comment Share on other sites More sharing options...
zxzxzx Posted February 26, 2009 Author Share Posted February 26, 2009 While 1 If WinExists('Untitled') Then MsgBox(0, '1', 'Once') ExitLoop EndIf WEndWhen MsgBox do once. Script exit! I don't want it exit. How to? Thanks Link to comment Share on other sites More sharing options...
EndFunc Posted February 26, 2009 Share Posted February 26, 2009 (edited) When MsgBox do once. Script exit!I don't want it exit. How to? ThanksThen you need to have whatever else the script is doing in side the While 1 loop or out side of it if there are other commands. Since there is nothing else to process, it will of course exit the script. It would be more helpful it you either posted more code or explained more of what you are trying to accomplish.Edit: Actually I am mistaken, it should continue the loop until you close the script. However it will continue to keep prompting a msg box when that window is open as you have it now. Edited February 26, 2009 by EndFunc EndFuncAutoIt is the shiznit. I love it. Link to comment Share on other sites More sharing options...
zxzxzx Posted February 26, 2009 Author Share Posted February 26, 2009 While 1 If WinExists('Untitled') Then MsgBox(0, '1', 'Once') ExitLoop EndIf WEndoÝ÷ Ûú®¢×ªº^© It work but when i close Untitled and open Untitled again >>> it not work Link to comment Share on other sites More sharing options...
Inverted Posted February 26, 2009 Share Posted February 26, 2009 Test this, then : $notepad_handle = 0 While 1 If $notepad_handle <> WinGetHandle ('Untitled') AND WinGetHandle ('Untitled') <> 0 Then MsgBox(0, '1', 'Once') $notepad_handle = WinGetHandle ('Untitled') EndIf WEnd It gets confused when 2 notepads are opened, when the second closes it finds the first again, but I'm trying to keep it simple Link to comment Share on other sites More sharing options...
zxzxzx Posted February 26, 2009 Author Share Posted February 26, 2009 (edited) Test this, then : $notepad_handle = 0 While 1 If $notepad_handle <> WinGetHandle ('Untitled') AND WinGetHandle ('Untitled') <> 0 Then MsgBox(0, '1', 'Once') $notepad_handle = WinGetHandle ('Untitled') EndIf WEndoÝ÷ Ø`zÛ¢wî±çpéö^¥§lj·¨¥éÞw^Ø^±ç(×%¢Ç¬×âÛ-çâ®ËZ¨§nëHßÙ¯(§Ú$yêb¶È¦¦Wþ«¨µê!¶§*.½êòç!"Ýý²÷«Êë~éCJ.Ö®¶sbb33c¶æ÷FWEöæFÆRÒ ¥vÆR bb33c¶æ÷FWEöæFÆRfÇC²fwC²väW7Bb33µVçFFÆVBb33²äBväW7Bb33µVçFFÆVBb33²fÇC²fwC²FVà ×6t&÷Âb33³b33²Âb33´öæ6Rb33² b33c¶æ÷FWEöæFÆRÒväW7Bb33µVçFFÆVBb33² VæD`¥tVæ@ Edited February 26, 2009 by zxzxzx Link to comment Share on other sites More sharing options...
Skruge Posted February 26, 2009 Share Posted February 26, 2009 Wow, all these replies and nobody suggested WinWait? WinWait('Untitled') MsgBox(0, '1', 'Once') [font="Tahoma"]"Tougher than the toughies and smarter than the smarties"[/font] Link to comment Share on other sites More sharing options...
Inverted Posted February 26, 2009 Share Posted February 26, 2009 Wow, all these replies and nobody suggested WinWait? WinWait('Untitled') MsgBox(0, '1', 'Once')Wow, all these replies and you still didn't use an infinite loop like we did ? Link to comment Share on other sites More sharing options...
EndFunc Posted February 26, 2009 Share Posted February 26, 2009 Wow, all these replies and nobody suggested WinWait? WinWait('Untitled') MsgBox(0, '1', 'Once') EndFuncAutoIt is the shiznit. I love it. Link to comment Share on other sites More sharing options...
Inverted Posted February 26, 2009 Share Posted February 26, 2009 (edited) I thought maybe the title was important for the original poster, that's why I used it. But your adaptation is cool also. And it would be a good optimization to replace the 3 ProcessExists with 1 and just save as an extra variable. To ease up on CPU usage I guess. It's in a loop after all Edited February 26, 2009 by Inverted 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