hmsSurprise Posted April 16, 2007 Share Posted April 16, 2007 I compiled a little script that just runs a simple while loop. What event would I watch for to make it quit when the red X in the top right corner is clicked? Thanks, jh #include <GUIConstants.au3> While 1 display('ControlGetFocus($title, $text) = ' & ControlGetFocus("") & @crlf ) Sleep(100) WEnd Func display($s, $s1 = '', $s2 ='', $s3 = '') Global $debugDisplayExists if $debugDisplayExists <> 1 Then Opt("GUIOnEventMode", 1) $w=800 $h=100 Global $debugDisplay_GUI = GUICreate("Reveal Control Focus", $w, $h, 1, @DesktopHeight-$h-75) Global $debugDisplay_Edit = GUICtrlCreateEdit("", 8, 8, $w-5, $h-5, BitOR($ES_AUTOVSCROLL,$ES_READONLY)) GUISetState(@SW_SHOW) $debugDisplayExists = 1 EndIf GUICtrlSetData($debugDisplay_Edit, @CRLF & $s & ', ' & $s1 & ', ' & $s2 & ', ' & $s3, 1) EndFunc Link to comment Share on other sites More sharing options...
Uten Posted April 16, 2007 Share Posted April 16, 2007 #include <GUIConstants.au3> While GuiGetMsg() <> $GUI_EVENT_CLOSE ;Do stuff WEnd Please keep your sig. small! Use the help file. Search the forum. Then ask unresolved questions :) Script plugin demo, Simple Trace udf, TrayMenuEx udf, IOChatter demo, freebasic multithreaded dll sample, PostMessage, Aspell, Code profiling Link to comment Share on other sites More sharing options...
hmsSurprise Posted April 16, 2007 Author Share Posted April 16, 2007 #include <GUIConstants.au3> While GuiGetMsg() <> $GUI_EVENT_CLOSE ;Do stuff WEnd Thanks, tried this but GuiGetMsg() always returns 0. jh Link to comment Share on other sites More sharing options...
PsaltyDS Posted April 16, 2007 Share Posted April 16, 2007 Thanks, tried this but GuiGetMsg() always returns 0.jhRead the help file about GUI MessageLoop Mode. Read the help file and you'll see that GuiGetMsg() = 0 just means nothing is happening. The help file says it will be something other than 0 only when a Window action, like clicking on the red X, happens. And while you're at it, read the help file... P.S. Have you read the help file yet? 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...
hmsSurprise Posted April 16, 2007 Author Share Posted April 16, 2007 (edited) Read the help file about GUI MessageLoop Mode. Read the help file and you'll see that GuiGetMsg() = 0 just means nothing is happening. The help file says it will be something other than 0 only when a Window action, like clicking on the red X, happens. And while you're at it, read the help file... P.S. Have you read the help file yet?OK, I should have stated that it always returns a zero when I click the red X.http://www.autoitscript.com/forum/index.ph...id=330220&#Complete EditI have read it many times, msg loop and event mode under gui concepts Edited April 16, 2007 by hmsSurprise Link to comment Share on other sites More sharing options...
PsaltyDS Posted April 16, 2007 Share Posted April 16, 2007 OK, I should have stated that it always returns a zero when I click the red X. http://www.autoitscript.com/forum/index.ph...id=330220&# Complete Edit I have read it many times, msg loop and event mode under gui concepts I don't think you can run event mode and get messages from GuiGetMsg() at the same time. You picked event mode with: Opt("GUIOnEventMode", 1) You'll find that in the h... well, you know! 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...
hmsSurprise Posted April 16, 2007 Author Share Posted April 16, 2007 I don't think you can run event mode and get messages from GuiGetMsg() at the same time. You picked event mode with: Opt("GUIOnEventMode", 1) You'll find that in the h... well, you know! Danged iffen it ain't. Well I have a propensity for not seeing what I am staring at, (grammar check) forest for the trees, etc. Just cut and pasted the display from something else that has been working for 4-5 days ( a major percentage of my time as a autoit cobbler) and was sure it worked just fine. Thanks for setting me straight (AutoIt-wise, think I am OK otherwise). Sorry if I have worn out my welcome. Will try to stay off the list for at least 5 minutes. :"> 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