Jump to content

Closing a compiled script


Recommended Posts

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

Thanks, tried this but GuiGetMsg() always returns 0.

jh

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...

:shocked:

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

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...

:shocked:

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 Edit

I have read it many times, msg loop and event mode under gui concepts

Edited by hmsSurprise
Link to comment
Share on other sites

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! :shocked:

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

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! :shocked:

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...