Trying to make different small scripts to learn autoit, this time I'm trying to make a script that when a button is pressed it will click in 1 place then click in another place then return the mouse to it's original position.
This is the original one that I made which works.
HotKeySet("c", "practice") while 1 sleep(1) WEnd Func practice() $pos=MouseGetPos() MouseClick("left",100,922,1,0) MouseClick("left",200,921,1,0) MouseMove($pos[0],$pos[1],0) EndFunc
The problem is when I try to implement an On/Off hotkey, I can no longer find a way to make it work. (ideally just 1 hotkey for turning on and off but would be nice to learn with 2 hotkeys as well)
Here is what I tried:
AutoIt
#include <Misc.au3> HotKeySet("{F1}", "_Pause") Global $Paused = False HotKeySet("c") While 1 If Not $Paused Then If _IsPressed("c") Then $pos=MouseGetPos() MouseClick("left",100,922,1,0) MouseClick("left",200,921,1,0) MouseMove($pos[0],$pos[1],0) EndIf EndIf WEnd Func _Pause() $Paused = Not $Paused EndFunc
But this code doesn't seem to be doing anything at all