Jump to content

Recommended Posts

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 post
Share on other sites

@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 post
Share on other sites

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 post
Share on other sites
  • Developers

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 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
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...