Mew Posted May 29, 2009 Share Posted May 29, 2009 Dear all, I am very new to autoit3 and all the knowledge that I got from autoit 1 is completely useless nowadays.....cry I want to see if anyone will be able to help me with this very simple script. I created this loop mouse movement and clicking script that will go on indifinitly but I have no idea how to terminate it by pressing any button. If anyone can help me with this? What I want to do is to end this script by pressing a button, pause, esc....any button works for me. here is the script: For $i = 0 to Step -0 MouseMove(476, 32) MouseClick("left") MouseClick("left") Sleep(500) MouseMove(300, 200) MouseDown("left") MouseUp("left") MouseDown("left") MouseUp("left") Sleep(1000) Next Func Pause() Global $PAUSED HotKeySet("{PAUSE}", "TogglePause") HotKeySet("{ESC}", "Terminate") EndFunc ;==>Pause Func TogglePause() $PAUSED = Not $PAUSED While $PAUSED Sleep(100) ToolTip('Script est en "Pause"', 0, 0) Wend ToolTip("") EndFunc ;==>TogglePause Func Terminate() While 1 Local $x = Pause() $X = Pause() If $X = 1 Then ExitLoop Sleep(10) SplashOff() GUISetControlEx($PROGRESS_1, 0) Wend EndFunc ;==>Terminate Func EnableHotKeys() HotKeySet("^a", "SelectAll") EndFunc ;==>EnableHotKeys Link to comment Share on other sites More sharing options...
JSThePatriot Posted May 29, 2009 Share Posted May 29, 2009 Why doesn't your Terminate() function call:Exit? I would recommend setting hotkeys at the top, and do something like the following to get an exit...HotKeySet("^!x", "_TerminateApp") ;CTRL+ALT+x Func _TerminateApp() Exit EndFunc I hope this helps some, Jarvis AutoIt Links File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out. ComputerGetInfo UDF's Updated! 11-23-2006 External Links Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more) Link to comment Share on other sites More sharing options...
Mew Posted May 29, 2009 Author Share Posted May 29, 2009 Thanks for your reply. Is this what you meant?Autoclick.au3 Link to comment Share on other sites More sharing options...
Mew Posted May 29, 2009 Author Share Posted May 29, 2009 Please see what is wrong with my script because it just won't stop with pressing Ctrl Alt and X.... THanks Link to comment Share on other sites More sharing options...
muncherw Posted May 29, 2009 Share Posted May 29, 2009 Please see what is wrong with my script because it just won't stop with pressing Ctrl Alt and X....THanksWorked fine for me. Closed out perfectly. Other People's Stuff:Andy Flesner's AutoIt v3: Your Quick Guide[topic="34302"]Locodarwin's ExcelCom_UDF[/topic][topic="61090"]MrCreatorR's Opera Library[/topic] Link to comment Share on other sites More sharing options...
JSThePatriot Posted May 29, 2009 Share Posted May 29, 2009 (edited) This is exactly what I have in my code, and it works fine. I will include the Pause function as well if you want that functionality.HotKeySet("{PAUSE}", "_PauseApp") HotKeySet("^!x", "_TerminateApp") While 1 Sleep(500) WEnd ;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> ;---*** Define Functions ***--- ;<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< Func _TerminateApp() Exit EndFunc Func _PauseApp() $Paused = NOT $Paused While $Paused Sleep(100) TrayTip("Application Paused", "Application has been paused...press the 'pause' button to resume", 20) WEnd TrayTip("", "", 0) EndFunc I just tried it on my system to be 100% positive, and it worked. You should be able to copy the above code simply for testing, and if it doesn't work then there must be something else going on. Edit01: Are you sure you pressed all three buttons at the same time? CTRL+ALT+x? Jarvis Edited May 29, 2009 by JSThePatriot AutoIt Links File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out. ComputerGetInfo UDF's Updated! 11-23-2006 External Links Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more) Link to comment Share on other sites More sharing options...
Mew Posted May 29, 2009 Author Share Posted May 29, 2009 Oops, my bad. You guys are super! I typed Ctrl "SHIFT" and X, LOL at myself. Thank you so much for your's help! 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