jthomas07762 Posted April 15, 2013 Posted April 15, 2013 (edited) Hey everyone i am new to auto it. I have recently downloaded the program and am trying to figure out how to get a program to "restart" its function when the pause/unpause button is used. I do not wish to have this loop, unless end loop time is long so it can be repaused without having to worry about it performing the action twice in a row rapidly. here is a script i found and edited to perform the function i need. Opt('MouseCoordMode', 0) Opt('PixelCoordMode', 0) HotKeySet('{END}', 'Quit') HotKeySet('{Home}', 'Pause') Global $Paused ;starts paused. press home to start. Pause() Send ("i") MouseClick("right",1019,604,1) Sleep ("100") MouseClick("right",1055,593,1) Sleep ("100") MouseClick("right",1091,586,1) Sleep ("100") MouseClick("right",1021,564,1) Sleep ("900") Send ("i") Func Pause() $Paused = Not $Paused While $Paused Sleep(100) ToolTip('Paused...', 0, 0) WEnd ToolTip("") EndFunc ;==>Pause Edited April 15, 2013 by jthomas07762
kylomas Posted April 15, 2013 Posted April 15, 2013 jthoma07762, What is it doing / not doing for you? kylomas Forum Rules Procedure for posting code "I like pigs. Dogs look up to us. Cats look down on us. Pigs treat us as equals." - Sir Winston Churchill
jthomas07762 Posted April 15, 2013 Author Posted April 15, 2013 It starts the program paused which i want. When i hit Home(unpause) it performs the operation flawlessly. but then the program exits. I wish to have the program stay open and possibly have it be able to restart and stop when i pause and unpause? if that is possible.
JohnOne Posted April 15, 2013 Posted April 15, 2013 Opt('MouseCoordMode', 0) Opt('PixelCoordMode', 0) HotKeySet('{END}', 'Quit') HotKeySet('{Home}', 'Pause') ;HotKeySet('{PGDN}', 'start') Global $Paused ;starts paused. press home to start. Pause() while 1 start() wend func start() Send ("i") MouseClick("right",1019,604,1) Sleep ("100") MouseClick("right",1055,593,1) Sleep ("100") MouseClick("right",1091,586,1) Sleep ("100") MouseClick("right",1021,564,1) Sleep ("900") Send ("i") endfunc Func Pause() $Paused = Not $Paused While $Paused Sleep(100) ToolTip('Paused...', 0, 0) WEnd ToolTip("") EndFunc ;==>Pause AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
water Posted April 15, 2013 Posted April 15, 2013 If you want to enhance your script I suggest to replace those Mouse* statements with ControlClick etc. Makes the script more reliable and independant of screen resolutions and window positions. My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
jthomas07762 Posted April 15, 2013 Author Posted April 15, 2013 Opt('MouseCoordMode', 0) Opt('PixelCoordMode', 0) HotKeySet('{END}', 'Quit') HotKeySet('{Home}', 'Pause') ;HotKeySet('{PGDN}', 'start') Global $Paused ;starts paused. press home to start. Pause() while 1 start() wend func start() Send ("i") MouseClick("right",1019,604,1) Sleep ("100") MouseClick("right",1055,593,1) Sleep ("100") MouseClick("right",1091,586,1) Sleep ("100") MouseClick("right",1021,564,1) Sleep ("900") Send ("i") endfunc Func Pause() $Paused = Not $Paused While $Paused Sleep(100) ToolTip('Paused...', 0, 0) WEnd ToolTip("") EndFunc ;==>Pause Thank you for helping me. That works perfectly! Now i am just wondering, the program was able to be closed by hitting the end button. I think i may have deleted this line(s) of coding. Could you possibly Show me how to add this back? and the timing seems to be not working? Or maybe 100 is just not enough. If you could show me the code to stop my code for about 5 seconds after the final function is performed (hitting the i button) this way i wont have to be precise in hitting the unpause and pause button. I will have a little leway before it restarts.. Also I saw the forums for beginners. any suggestions on good posts to read up on?
Moderators SmOke_N Posted April 15, 2013 Moderators Posted April 15, 2013 (edited) Reference:HotKeySet('{END}', 'Quit')Solution:Write the function this "HotKeySet" is referencing to: (Hint: "Quit")Lookup "Exit" in the help file.P.S. (It's only 3 lines of code) Edited April 15, 2013 by SmOke_N Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.
jthomas07762 Posted April 15, 2013 Author Posted April 15, 2013 (edited) Reference: HotKeySet('{END}', 'Quit') Solution: Write the function this "HotKeySet" is referencing to: (Hint: "Quit") Lookup "Exit" in the help file. P.S. (It's only 3 lines of code) Thanks pretty simple once i thought about it. Thanks for the hint. I appreciate you not giving the code and making me figure it out, always better to learn that way. Thanks again! Program runs smoothly. Figure out time problem also. 100 Is a very minimal time lol.. Here is a copy of the script i found, edited; then finished for my specific task. expandcollapse popupOpt('MouseCoordMode', 0) Opt('PixelCoordMode', 0) HotKeySet('{END}', 'Quit') HotKeySet('{Home}', 'Pause') Global $Paused ;starts paused. press home to start. Pause() while 1 start() wend func start() Send("i") MouseClick("right",1019,604,1) Sleep("100") MouseClick("right",1055,593,1) Sleep("100") MouseClick("right",1091,586,1) Sleep("100") MouseClick("right",1021,564,1) Sleep("100") Send("i") Sleep("1000") endfunc Func Quit() Exit EndFunc Func Pause() $Paused = Not $Paused While $Paused Sleep(100) ToolTip('Paused...', 0, 0) WEnd ToolTip("") EndFunc ;==>Pause Edited April 15, 2013 by jthomas07762
Starstar Posted April 16, 2013 Posted April 16, 2013 Use Controlclick instead of Mouse click for example.......... controlclick("windows title","","[Class:........; ID:......; INTANCE:....]","Right",1) Use Au3.info to get Class name,,, ID and INSTANCE etc...................Au3.inf is normly in C:Program FilesAutoIt3 Life is like a coin. You can spend it Anyway as you wish and for your kind information. "you can spend it only once."
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