Jump to content

Unable to put the 2 together


ChehSun
 Share

Recommended Posts

;;;; Mouse Motion

Global $Paused, $counter = 0
HotKeySet("{F2}", "TogglePause")
HotKeySet("{ESC}", "Terminate")
HotKeySet("+!d", "ShowMessage")


Func Start()


While 1
MouseClick("Primary",1398,830)
MouseClick("Primary",827,713)
MouseClick("Primary",963,459)

wEnd


EndFunc

While 1
$counter +=1
ToolTip('Script is "Running"',0,0, $counter, 1)
Sleep(700)
WEnd



Func TogglePause()
$Paused = NOT $Paused
While $Paused
sleep(100)
ToolTip('Script is "Paused"',0,0, $counter, 1)
WEnd
ToolTip("")
EndFunc


Func Terminate()
Exit 0
EndFunc

Func ShowMessage()
MsgBox(4096,"","This is a message.")
EndFunc

I cannot seem to put a function and a toggle pause key together. if someone could helpfully point me towards the right path i would be grateful.

Link to comment
Share on other sites

I think you want to avoid any functions when the script is paused and then go back to normal once it is resumed. :graduated: How about this:

;;;; Mouse Motion

Global $Paused, $counter = 0
HotKeySet("{F2}", "TogglePause")
HotKeySet("{ESC}", "Terminate")
HotKeySet("+!d", "ShowMessage")


Func Start()


While 1
MouseClick("Primary",1398,830)
MouseClick("Primary",827,713)
MouseClick("Primary",963,459)

wEnd


EndFunc

While 1
$counter +=1
ToolTip('Script is "Running"',0,0, $counter, 1)
Sleep(700)
WEnd



Func TogglePause()
$Paused = NOT $Paused
If $Paused then
HotKeySet("{ESC}")
HotKeySet("+!d")
else
HotKeySet("{ESC}", "Terminate")
HotKeySet("+!d", "ShowMessage")
EndIf
While $Paused
sleep(100)
ToolTip('Script is "Paused"',0,0, $counter, 1)
WEnd
ToolTip("")
EndFunc


Func Terminate()
Exit 0
EndFunc

Func ShowMessage()
MsgBox(4096,"","This is a message.")
EndFunc

Did you get what you wanted?

Edited by MKISH

----------------------------------------

:bye: Hey there, was I helpful?

----------------------------------------

My Current OS: Win8 PRO (64-bit); Current AutoIt Version: v3.3.8.1

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...