Jump to content
Sign in to follow this  
Noobee

Pause script while running

Recommended Posts

Noobee

Help pls..

How can i pause the script directly while running, actually when i press alt+1 the script will pause after the script end..

#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <ButtonConstants.au3>
#include <StaticConstants.au3>
Global $Paused

HotKeySet("!1", "Start") ;script can be start/pasue by pressing -
HotKeySet("{ESC}", "Terminate") ;script can be stopped by pressing -


#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Version 1.0", 351, 421, 192, 124)
$Input1 = GUICtrlCreateInput("661", 40, 64, 49, 21)
$Input2 = GUICtrlCreateInput("702", 40, 96, 49, 21)
$Input3 = GUICtrlCreateInput("738", 40, 128, 49, 21)
$Input4 = GUICtrlCreateInput("775", 40, 160, 49, 21)
$Input5 = GUICtrlCreateInput("813", 40, 192, 49, 21)
$Input6 = GUICtrlCreateInput("851", 40, 224, 49, 21)
$Input7 = GUICtrlCreateInput("886", 40, 256, 49, 21)
$Input8 = GUICtrlCreateInput("926", 40, 288, 49, 21)
$Input9 = GUICtrlCreateInput("966", 40, 320, 49, 21)
$Input10 = GUICtrlCreateInput("1002", 40, 352, 49, 21)
$Input11 = GUICtrlCreateInput("509", 144, 64, 49, 21)
$Input12 = GUICtrlCreateInput("509", 144, 96, 49, 21)
$Input13 = GUICtrlCreateInput("509", 144, 128, 49, 21)
$Input14 = GUICtrlCreateInput("509", 144, 160, 49, 21)
$Input15 = GUICtrlCreateInput("509", 144, 192, 49, 21)
$Input16 = GUICtrlCreateInput("509", 144, 224, 49, 21)
$Input17 = GUICtrlCreateInput("509", 144, 256, 49, 21)
$Input18 = GUICtrlCreateInput("509", 144, 288, 49, 21)
$Input19 = GUICtrlCreateInput("509", 144, 320, 49, 21)
$Input20 = GUICtrlCreateInput("509", 144, 352, 49, 21)
$Input21 = GUICtrlCreateInput("300", 280, 384, 33, 21)
$Label0 = GUICtrlCreateLabel("X", 24, 64, 15, 24)
GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
$Label1 = GUICtrlCreateLabel("X", 24, 96, 15, 24)
GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
$Label2 = GUICtrlCreateLabel("X", 24, 128, 15, 24)
GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
$Label3 = GUICtrlCreateLabel("X", 24, 160, 15, 24)
GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
$Label4 = GUICtrlCreateLabel("X", 24, 192, 15, 24)
GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
$Label5 = GUICtrlCreateLabel("X", 24, 224, 15, 24)
GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
$Label6 = GUICtrlCreateLabel("X", 24, 256, 15, 24)
GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
$Label7 = GUICtrlCreateLabel("X", 24, 288, 15, 24)
GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
$Label8 = GUICtrlCreateLabel("X", 24, 320, 15, 24)
GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
$Label9 = GUICtrlCreateLabel("X", 24, 352, 15, 24)
GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
$Label10 = GUICtrlCreateLabel("Y", 128, 64, 15, 24)
GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
$Label11 = GUICtrlCreateLabel("Y", 128, 96, 15, 24)
GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
$Label12 = GUICtrlCreateLabel("Y", 128, 128, 15, 24)
GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
$Label13 = GUICtrlCreateLabel("Y", 128, 160, 15, 24)
GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
$Label14 = GUICtrlCreateLabel("Y", 128, 192, 15, 24)
GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
$Label15 = GUICtrlCreateLabel("Y", 128, 224, 15, 24)
GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
$Label16 = GUICtrlCreateLabel("Y", 128, 256, 15, 24)
GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
$Label17 = GUICtrlCreateLabel("Y", 128, 288, 15, 24)
GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
$Label18 = GUICtrlCreateLabel("Y", 128, 320, 15, 24)
GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
$Label19 = GUICtrlCreateLabel("Y", 128, 352, 15, 24)
GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
$Label21 = GUICtrlCreateLabel("Delay", 280, 368, 31, 17)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###




While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
EndSwitch
 WEnd





Func Start()
    $Paused = NOT $Paused
    While $Paused


 MouseMove(GUICtrlRead($Input1), GUICtrlRead($Input11), 3)
 Send("{CTRLDOWN}")
 MouseClick("right")
 MouseClick("right")
 MouseClick("right")
 MouseClick("right")
 MouseClick("right")
 Send("{CTRLUP}")
 sleep(guictrlread ($Input21))


 MouseMove(GUICtrlRead($Input2), GUICtrlRead($Input12), 3)
 Send("{CTRLDOWN}")
 MouseClick("right")
 MouseClick("right")
 MouseClick("right")
 MouseClick("right")
 MouseClick("right")
 Send("{CTRLUP}")
 sleep(Guictrlread ($Input21))



 MouseMove(GUICtrlRead($Input3), GUICtrlRead($Input13), 3)
 Send("{CTRLDOWN}")
 MouseClick("right")
 MouseClick("right")
 MouseClick("right")
 MouseClick("right")
 MouseClick("right")
 Send("{CTRLUP}")
 sleep(Guictrlread ($Input21))


 MouseMove(GUICtrlRead($Input4), GUICtrlRead($Input14), 3)
 Send("{CTRLDOWN}")
 MouseClick("right")
 MouseClick("right")
 MouseClick("right")
 MouseClick("right")
 MouseClick("right")
 Send("{CTRLUP}")
 sleep(Guictrlread ($Input21))



 MouseMove(GUICtrlRead($Input5), GUICtrlRead($Input15), 3)
 Send("{CTRLDOWN}")
 MouseClick("right")
 MouseClick("right")
 MouseClick("right")
 MouseClick("right")
 MouseClick("right")
 Send("{CTRLUP}")
 sleep(Guictrlread ($Input21))



 MouseMove(GUICtrlRead($Input6), GUICtrlRead($Input16), 3)
 Send("{CTRLDOWN}")
 MouseClick("right")
 MouseClick("right")
 MouseClick("right")
 MouseClick("right")
 MouseClick("right")
 Send("{CTRLUP}")
 sleep(Guictrlread ($Input21))



 MouseMove(GUICtrlRead($Input7), GUICtrlRead($Input17), 3)
 Send("{CTRLDOWN}")
 MouseClick("right")
 MouseClick("right")
 MouseClick("right")
 MouseClick("right")
 MouseClick("right")
 Send("{CTRLUP}")
 sleep(Guictrlread ($Input21))



 MouseMove(GUICtrlRead($Input8), GUICtrlRead($Input18), 3)
 Send("{CTRLDOWN}")
 MouseClick("right")
 MouseClick("right")
 MouseClick("right")
 MouseClick("right")
 MouseClick("right")
 Send("{CTRLUP}")
 sleep(Guictrlread ($Input21))


 MouseMove(GUICtrlRead($Input9), GUICtrlRead($Input19), 3)
 Send("{CTRLDOWN}")
 MouseClick("right")
 MouseClick("right")
 MouseClick("right")
 MouseClick("right")
 MouseClick("right")
 Send("{CTRLUP}")
 sleep(Guictrlread ($Input21))


 MouseMove(GUICtrlRead($Input10), GUICtrlRead($Input20), 3)
 Send("{CTRLDOWN}")
 MouseClick("right")
 MouseClick("right")
 MouseClick("right")
 MouseClick("right")
 MouseClick("right")
 Send("{CTRLUP}")
 sleep(Guictrlread ($Input21))

sleep(30)



    WEnd

EndFunc


Func Terminate()
    Exit 0
EndFunc
Edited by Noobee

Share this post


Link to post
Share on other sites
BigDod

Code below in wrong position

sleep(30)     
 
WEnd EndFunc
 
Edited by BigDod


Get Beta versions Here Get latest SciTE editor Here AutoIt 1-2-3 by Valuater - A great starting point.

Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

Share this post


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
Sign in to follow this  

×