bartomas Posted March 23, 2008 Share Posted March 23, 2008 I'm trying to write Autoit script that does a few simple drag and drop in a window. That works fine. But I'd also like to be able to abort the commands when the script is running by pressing the ENTER key. I defined a hotkey for ENTER associated to a terminate function as I have seen done in a post in this forum. I also enveloped the commands of the body of the script in a For loop that runs exactly one time, because I read in the Autoit help file that a hotkey interrupts the current function or statement. (maybe the For loop isn't necessary, but anyway the hotkey doesn't work without it either). My problem is that when executing the commands in the For loop, my pressing the ENTER key has no effect at all. The commands go on being executed regardless. Thankyou for any help. My script: HotKeySet("{ENTER}", "Terminate") Func Terminate() Exit 0 EndFunc For $i=0 to 0 winActivate("test") MouseClickDrag("left",571,152,220,152,1) MouseClick ( "left", 236, 570 , 10) Next Link to comment Share on other sites More sharing options...
d4rk Posted March 23, 2008 Share Posted March 23, 2008 it works fine for me [quote]Don't expect for a perfect life ... Expect a least troubles ones[/quote]Contact me : ass@kiss.toWhat I Have Done :Favorites Manager Mangage your favorite's folder, that's coolPC Waker For those who want to save stickersWebScipts Supporter For those who've just started with Web and WebScriptsTemporary Looker Simple but powerful to manage your Temporary folder, you know what you downloaded[UDF] _NumberFormat() Better performance on number display[UDF] _DirGet() What a folder contain [how many (hidden,normal,...) files], with one line of code[UDF] _IsPressEs() Just like _IsPress() but for a group of keys Link to comment Share on other sites More sharing options...
Aassdd Posted March 23, 2008 Share Posted March 23, 2008 (edited) Exit 0 and 0 to 0? Edited March 23, 2008 by Aassdd Link to comment Share on other sites More sharing options...
FreeFry Posted March 24, 2008 Share Posted March 24, 2008 Exit 0 means exit with return code 0, ie. no error. the 0 to 0 part boggles me too.. lol There's no need to use a loop if the script is just supposed to do it's magic once... Link to comment Share on other sites More sharing options...
Innovative Posted March 24, 2008 Share Posted March 24, 2008 HotKeySet("{ENTER}", "Terminate") Func Terminate() Exit EndFunc For $i=1 to X ; <-- How many times would you want to do the below actions winActivate("test") MouseClickDrag("left",571,152,220,152,1) MouseClick ( "left", 236, 570 , 10) Next 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