El Glyndo Posted May 30, 2006 Share Posted May 30, 2006 Hi, I', completely new to script writing, but I've written a small one that automates a copying and pasting function that I have to hundreds of times a day. I need to know if there is a way I can cancel the script while it is running. Is that possible? Link to comment Share on other sites More sharing options...
AutoItKing Posted May 30, 2006 Share Posted May 30, 2006 HotKeySet("{Esc}",_MyExit) Func _MyExit() Exit EndFunc Easy as that! http://www.autoitking.co.nr Site is DOWN | My deviantART | No Topic Topic - Don't do it!-------------------- UDF's/Scripts:AutoIt: [BenEditor 3.6] [_ShutDown()]PHP: [CommentScript]Web Based AutoIt: [MemStats] [HTML to AU3] [User LogIn and SignUp script] Link to comment Share on other sites More sharing options...
herewasplato Posted May 31, 2006 Share Posted May 31, 2006 @El Glyndo, Welcome to the forums. Like AutoItKing said, you can use code like:HotKeySet("{ESC}", "_MyExit") ;your code goes here Func _MyExit() Exit EndFunc ;==>_MyExit...but where I placed "your code goes here" just make sure that none of your code sends the escape key or your script will end at that point. If you need to send the escape key to some other application, then just pick a different key to use as the "HotKey". Also, the help file states:AutoIt normally creates a tray icon when running, and right-clicking this icon allows the user to pause or exit the script.Although a regular single left click does the same thing... (This assumes that your script allows you time to move the mouse to that icon.) @AutoItKing, One small change: HotKeySet("{ESC}", "_MyExit") [size="1"][font="Arial"].[u].[/u][/font][/size] Link to comment Share on other sites More sharing options...
El Glyndo Posted May 31, 2006 Author Share Posted May 31, 2006 Thanks for that guys, makes it a lot easier to use the HotKey. The script doesn't allow the mouse to be used by me so I'm glad that HotKey worked! Once again, many thanks Link to comment Share on other sites More sharing options...
AutoItKing Posted May 31, 2006 Share Posted May 31, 2006 AutoIt also has a built in hot key to exit if I'm not mistaken. I believe it's the escape key? http://www.autoitking.co.nr Site is DOWN | My deviantART | No Topic Topic - Don't do it!-------------------- UDF's/Scripts:AutoIt: [BenEditor 3.6] [_ShutDown()]PHP: [CommentScript]Web Based AutoIt: [MemStats] [HTML to AU3] [User LogIn and SignUp script] Link to comment Share on other sites More sharing options...
Developers Jos Posted May 31, 2006 Developers Share Posted May 31, 2006 AutoIt also has a built in hot key to exit if I'm not mistaken. I believe it's the escape key?Leaning something new everyday ... SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. 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