Sign in to follow this  
Followers 0
ChehSun

Unable to put the 2 together

3 posts in this topic

;;;; 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.

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites

Oo for sure, when should i implement the function then?

*i tried that code but it still does not recognize the mouse click functions. Suggestions?

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  
Followers 0