amokoura Posted June 3, 2008 Share Posted June 3, 2008 (edited) Is it possible for a script to receive a message when a certain window closes?EDIT: This question was stupid. More detailed in this reply Edited June 3, 2008 by amokoura Link to comment Share on other sites More sharing options...
Airwolf Posted June 3, 2008 Share Posted June 3, 2008 Is it possible for a script to receive a message when a certain window closes?(tried searching..)WinClose() will attempt to close a window and will return 1 if successful. WinWaitClose() simply waits for a window to close and returns 1 when the window closes. You can also add a timeout to WinWaitClose(). Certifications: A+, Network+, Security+, Linux+, LPIC-1, MCSA | Languages: AutoIt, C, SQL, .NETBooks: AutoIt v3: Your Quick Guide - $7.99 - O'Reilly Media - September 2007-------->[u]AutoIt v3 Development - newbie to g33k[/u] - Coming Soon - Fate Publishing - Spring 2013UDF Libraries: SkypeCOM UDF Library | ADUC Computers OU Cleanup | Find PixelChecksumExamples: Skype COM Examples - Skype4COMLib Examples converted from VBS to AutoIt Link to comment Share on other sites More sharing options...
zorphnog Posted June 3, 2008 Share Posted June 3, 2008 You can do something like: While WinExists("My window title") Sleep(250) WEnd ;window is closed, do something Link to comment Share on other sites More sharing options...
Airwolf Posted June 3, 2008 Share Posted June 3, 2008 While WinExists("My window title") Sleep(250) WEnd ;window is closed, do somethingoÝ÷ Ù8b²+-ëæ¬jëh×6WinWaitClose("My window title") ;window is closed, do something Certifications: A+, Network+, Security+, Linux+, LPIC-1, MCSA | Languages: AutoIt, C, SQL, .NETBooks: AutoIt v3: Your Quick Guide - $7.99 - O'Reilly Media - September 2007-------->[u]AutoIt v3 Development - newbie to g33k[/u] - Coming Soon - Fate Publishing - Spring 2013UDF Libraries: SkypeCOM UDF Library | ADUC Computers OU Cleanup | Find PixelChecksumExamples: Skype COM Examples - Skype4COMLib Examples converted from VBS to AutoIt Link to comment Share on other sites More sharing options...
zorphnog Posted June 3, 2008 Share Posted June 3, 2008 This is the same as:Well actually, there is a slight difference. A While loop with WinExists is not blocking. So you can perform other tasks within the While loop without waiting until that window is closed. Link to comment Share on other sites More sharing options...
Airwolf Posted June 3, 2008 Share Posted June 3, 2008 Well actually, there is a slight difference. A While loop with WinExists is not blocking. So you can perform other tasks within the While loop without waiting until that window is closed.True. If the only purpose is to wait until the window closes, then they are identical. We would need to know more about the OP's intentions to recommend the best solution. Certifications: A+, Network+, Security+, Linux+, LPIC-1, MCSA | Languages: AutoIt, C, SQL, .NETBooks: AutoIt v3: Your Quick Guide - $7.99 - O'Reilly Media - September 2007-------->[u]AutoIt v3 Development - newbie to g33k[/u] - Coming Soon - Fate Publishing - Spring 2013UDF Libraries: SkypeCOM UDF Library | ADUC Computers OU Cleanup | Find PixelChecksumExamples: Skype COM Examples - Skype4COMLib Examples converted from VBS to AutoIt Link to comment Share on other sites More sharing options...
amokoura Posted June 3, 2008 Author Share Posted June 3, 2008 (edited) more about the OP's intentions Thanks for replies. My intention was the "Window Close Waiter" to run in background of the script. The script is doing it's own thing and immediately after a certain window closes, the script would be notified of it. Maybe some global variable changes or something. Optionally a function would be called if a window message like WM_CLOSE happened. I haven't used messages before so I don't know if it could work. It would be nice if I could save the adlib for some other use. Could this work for example: global $isClosed = false AdlibEnable ("closeWaiter") while true ; ... ; main code here ; ... if $isClosed then ; ... ; Window closed, react! ; ... endif wend func closeWaiter if winwaitclose("window title") then $isClosed = true endif endfunc Edited June 3, 2008 by amokoura Link to comment Share on other sites More sharing options...
Airwolf Posted June 3, 2008 Share Posted June 3, 2008 (edited) expandcollapse popupglobal $isClosed = false AdlibEnable ("closeWaiter") while true ; ... ; main code here ; ... if $isClosed then ; ... ; Window closed, react! ; ... endif wend func closeWaiter if winwaitclose("window title") then $isClosed = true endif endfuncoÝ÷ Ù¬¶¬Â)eiÇ(b²!jܨ¹ªÞÁ©íx¢íýYÞyÛhr§âZ)Öj+B|¨º·îËb¢{h!óhµh§¬¶Ëa¢è!jëh×6global $isClosed = false AdlibEnable ("closeWaiter") while true ; ... ; main code here ; ... if $isClosed then ; ... ; Window closed, react! ; ... endif wend func closeWaiter If Not WinExists("window title") then $isClosed = true endif endfunc Edited June 3, 2008 by Airwolf123 Certifications: A+, Network+, Security+, Linux+, LPIC-1, MCSA | Languages: AutoIt, C, SQL, .NETBooks: AutoIt v3: Your Quick Guide - $7.99 - O'Reilly Media - September 2007-------->[u]AutoIt v3 Development - newbie to g33k[/u] - Coming Soon - Fate Publishing - Spring 2013UDF Libraries: SkypeCOM UDF Library | ADUC Computers OU Cleanup | Find PixelChecksumExamples: Skype COM Examples - Skype4COMLib Examples converted from VBS to AutoIt Link to comment Share on other sites More sharing options...
amokoura Posted June 4, 2008 Author Share Posted June 4, 2008 Thanks! Would it be possible to do it without adlib? I'm doing this for a helper function library so it would be nice to spare the adlib for the main scripts. Link to comment Share on other sites More sharing options...
Airwolf Posted June 4, 2008 Share Posted June 4, 2008 (edited) Thanks!Would it be possible to do it without adlib? I'm doing this for a helper function library so it would be nice to spare the adlib for the main scripts.Not without using multiple scripts, or a UDF that I don't know about. Edited June 4, 2008 by Airwolf123 Certifications: A+, Network+, Security+, Linux+, LPIC-1, MCSA | Languages: AutoIt, C, SQL, .NETBooks: AutoIt v3: Your Quick Guide - $7.99 - O'Reilly Media - September 2007-------->[u]AutoIt v3 Development - newbie to g33k[/u] - Coming Soon - Fate Publishing - Spring 2013UDF Libraries: SkypeCOM UDF Library | ADUC Computers OU Cleanup | Find PixelChecksumExamples: Skype COM Examples - Skype4COMLib Examples converted from VBS to AutoIt Link to comment Share on other sites More sharing options...
rasim Posted June 4, 2008 Share Posted June 4, 2008 amokouraWould it be possible to do it without adlib? I'm doing this for a helper function library so it would be nice to spare the adlib for the main scripts.Use _Timer_SetTimer() function. 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