How do I isolate a script from Gui and other script

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
wasd9555
Posts: 3
Joined: 19 Jul 2021, 12:03

How do I isolate a script from Gui and other script

Post by wasd9555 » 19 Jul 2021, 14:03

Im making a Script that has a Timer Gui, A mouse move script, and a Msgbox, But Is there a way to isolate a script from everything else like if I say pause it will only pause the script because whenever I have the timer open and I pause the mouse move script it pauses everything so can I make the GUI a separate thing but in the same script or maybe have a toggle button like I press F1 it starts mouse moving then I press it again and it pauses the mouse move


Code: Select all

#NoEnv
#singleinstance force


timerm := "00"
timers := "00"
stopped := "0"

Gui, Font, s15 cWhite
Gui, Add, Text,x60 y20 w60 h20 vTText, %timerm%:%timers%
Gui, Add, Button,x4 y42 w80 h20 vPause, Pause
Gui, Color, White
Gui, Add, Button,x85 y42 w80 h20 vReset, Reset
F3::
Toggle := !toggle
If toggle 
Gui, Show,x0 y0 h60 w165, Stopwatch
Gui, Color, Black
if else  
   Gui, hide
Settimer, Stopwatch, 1000


Return

Stopwatch:
timers += 1
if(timers > 59)
{
	timerm += 1
	timers := "0"
	GuiControl, , TText ,  %timerm%:%timers%
}
if(timers < 10)
{
	GuiControl, , TText ,  %timerm%:0%timers%
}
else
{
	GuiControl, , TText ,  %timerm%:%timers%
}
return

ButtonPause:
if(stopped = 0)
{
	Settimer, Stopwatch, off
	stopped = 1
}
else
{
	Settimer, Stopwatch, 999
	stopped = 0
}
return

ButtonReset:
timerm := "00"
timers := "00"
GuiControl, , TText ,  %timerm%:%timers%
return


GuiClose:
GuiEscape:
Gui, Hide
return





F1::
Loop,
{
MouseClick, left, 242, 607
Sleep 500
MouseClick, left, 612, 452
Sleep 500
MouseClick, left, 362, 353
Sleep 500
MouseClick, left, 1251, 954
}

F2::
pause








ins::
Msgbox, Start/Stop script - F1/F2, Timer - F3, Show Controls - Ins, Exitapp - END
return

END::
Exitapp
[Mod edit: [code][/code] tags added.]

Return to “Ask for Help (v1)”