Code: Select all
#Requires AutoHotkey v2.0
#MaxThreadsPerHotkey 2
pic1 := 'HBITMAP:*' LoadPicture("PathToOnfIndicator")
pic2 := 'HBITMAP:*' LoadPicture("PathToOffIndicator")
statusGui := Gui("+AlwaysOnTop -Caption")
pic := statusGui.AddPic("w50 h-1", pic2)
statusGui.Show
ExitButton::ExitApp
ToggleButton::
{
static toggle := 0
toggle := !toggle
if toggle
{
pic.Value := pic1
Loop
{
ControlSend("ButtonPress",, "ahk_exe window.exe")
delay := Random(x, y)
sleep delay
}
}
else
{
pic.Value := pic2
}
}
- The script works 3 times, then stays with the On indicator forever
- It might even not work without a reload at the else statement
- After a few changes, I managed to make it kinda work, but there's a delay from On to Off, as if it's waiting for the sleep to finish
I still haven't positioned the indicator yet, and it still has a white background instead of a transparent one. I'm assuming I can do these two things (maybe wrong) and would like to resolve this problem first. Sorry if the code is messy/inefficient, I pretty much just stitched a few examples together, since I suck at code. Any help would be appreciated!