Sign in to follow this  
Followers 0
Info

Fast Question

14 posts in this topic

How can I do that if I push "{Escape}", it will automatic exit my GUI?

Please answer me.

Share this post


Link to post
Share on other sites



Fast question....hmm, I'm sure you mean you want a fast answer, but you wont get one.

Pressing escape in a active GUI sends the $GUI_EVENT_CLOSE message at default (can be toggled

with GUICloseOnESC), which is also sent when clicking the close-button in a GUI, so you just need to

check for that message.

#include <GUIConstants.au3>

GUICreate("", 300, 300)
GUISetState()

While 1
    $nMsg = GUIGetMsg()
    If $nMsg = $GUI_EVENT_CLOSE Then Exit
WEnd

If you would like to close the GUI and/or script even when the GUI is inactive then look up HotKeySet.

Share this post


Link to post
Share on other sites

Dude, I just want that if I push a button, like {Esc}, it will automatic exit my script, even if the script is minimized.

I don't understand what you just gave to me.

Share this post


Link to post
Share on other sites

HotKeySet("{ESC}"  , "doesc")
Func doesc()
EXIT
EndFunc


Only two things are infinite, the universe and human stupidity, and i'm not sure about the former -Alber EinsteinPractice makes perfect! but nobody's perfect so why practice at all?http://forum.ambrozie.ro

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Dude, I just want that if I push a button, like {Esc}, it will automatic exit my script, even if the script is minimized.

I don't understand what you just gave to me.

Don't you dude me. You said you wanted the GUI to be closed when you pressed escape.

You didn't say anything about if the GUI had to be active or not, but I gave you solutions

to both scenarios.

  • "Pressing escape in a active GUI sends the $GUI_EVENT_CLOSE...so you just need to check for that message."
  • "If you would like to close the GUI and/or script even when the GUI is inactive then look up HotKeySet."
You now say you wanted the script to be closed even when the GUI was inactive and since I

in the first part of my post explained how to do it when the GUI was active you should've just

ignored that part... Instead you should follow my second suggestion... looking up HotKeySet.

Did you do that? Somehow I doubt it.

Edited by Helge

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

HotKeySet("{ESC}"  , "doesc")
Func doesc()
EXIT
EndFunc
Thanks, working. =)

And, 1 more question:

How I do that if I prees 2 keys it will exit the script,

like "HotKeySet("{ESC}" & "{Shift}" , "doesc")

____Func doesc()

____EXIT

____EndFunc"?

Don't you dude me. You said you wanted the GUI to be closed when you pressed escape.

You didn't say anything about if the GUI had to be active or not, but I gave you solutions

to both scenarios.

  • "Pressing escape in a active GUI sends the $GUI_EVENT_CLOSE...so you just need to check for that message."
  • "If you would like to close the GUI and/or script even when the GUI is inactive then look up HotKeySet."
You now say you wanted the script to be closed even when the GUI was inactive and since I

in the first part of my post explained how to do it when the GUI was active you should've just

ignored that part... Instead you should follow my second suggestion... looking up HotKeySet.

Did you do that? Somehow I doubt it.

I don't even have power to commant this. Edited by Info

Share this post


Link to post
Share on other sites

Up, answer me please.

Share this post


Link to post
Share on other sites

I don't even have power to commant this.

So why you even post here? on that one you have "power"?

The man is trying to help you, and you say you not have "power" to read what he wrote?

How I do that if I prees 2 keys it will exit the script

In that case, i say RTFM! (help file) :)

P.S

If you need help, you learn how to get (ask) it, else... you don't get it.


Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

AutoIt is simple, subtle, elegant. © AutoIt Team

Share this post


Link to post
Share on other sites

So why you even post here? on that one you have "power"?

The man is trying to help you, and you say you not have "power" to read what he wrote?

In that case, i say RTFM! (help file) :)

P.S

If you need help, you learn how to get (ask) it, else... you don't get it.

He didn't helped me at all.

Share this post


Link to post
Share on other sites

He didn't helped me at all.

Define "help".

If you mean by giving you the complete code that you wanted, then no, I didn't help you.

When the person asking the question haven't shown much effort I prefer to tell them where

and how they can solve it by themselves, and I think I did a good job in this case. If you had

opened the helpfile and looked at the suggested functions I'm sure you would've solved your

problem by now.

Share this post


Link to post
Share on other sites

Thanks, working. =)

And, 1 more question:

How I do that if I prees 2 keys it will exit the script,

like "HotKeySet("{ESC}" & "{Shift}" , "doesc")

____Func doesc()

____EXIT

____EndFunc"?

I don't even have power to commant this.

try this

HotKeySet("{ESC}" & "{Shift}" , "close")

Func close()

exit

EndFunc

this should work...

Share this post


Link to post
Share on other sites

Shift Escape is "+{ESC}". That is the hotkey you would want.

Share this post


Link to post
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
Sign in to follow this  
Followers 0