Need help with my script

Get help with using AutoHotkey and its commands and hotkeys
TheBrohman
Posts: 13
Joined: 07 Dec 2015, 12:31

Need help with my script

07 Dec 2015, 12:33

Hello there. I am in need of help to make this program work. I want it so when I check the checkbox, it will start the loop, but I have no idea why this isn't working.

Code: Select all

Gui, +AlwaysOnTop
Gui, Font, cBlue
Gui, Add, Checkbox, vStart, Running?
Gui, Show, AutoSize x0 y0, Spam
return

GuiControlGet, Start
if Start = 1
{
	Loop
	{
				Send, {1}
				Send, {2}
				Send, {3}
				Send, {4}
				Send, {5}
				Send, {6}
				Send, {7}
				Send, {8}
				Send, {9}
				Sleep 100
	}
}
return

GuiClose:
ExitApp
User avatar
Exaskryz
Posts: 2876
Joined: 17 Oct 2015, 20:28

Re: Need help with my script

07 Dec 2015, 12:39

You have no gLabel nor SetTimer. One of those should work, not sure if either wouldn't.

Do know that you won't be able to break that loop though. If SetTimer works, I would use that instead of a Loop, and have it execute the Send commands if Start is still 1. But otherwise you can use a While-loop instead.
TheBrohman
Posts: 13
Joined: 07 Dec 2015, 12:31

Re: Need help with my script

07 Dec 2015, 12:59

Hmm.. I had that script working before, but I wanted to make a GUI for it, as I use most my keys keybinded to either windows functions, or game functions, and in the loop I had

Code: Select all

Loop {
	if start = 1 {
		;all the send stuff, cba to type it in now.
	}
}
And then at the bottom of the code I had a keybound to my numpad, and when I pressed it start would be set to 1, and when I pressed it again, it would be set to 0. And it worked fine, but I want to use a checkbox instead so I can bind most of my keys. :P
kon
Posts: 1756
Joined: 29 Sep 2013, 17:11

Re: Need help with my script

07 Dec 2015, 15:18

Maybe:

Code: Select all

Gui, +AlwaysOnTop
Gui, Font, cBlue
Gui, Add, Checkbox, vStart gMyLabel, Running?
Gui, Show, AutoSize x0 y0 NA, Spam
return

; This label will be fired by the Checkbox's gLabel and by SetTimer
MyLabel:
GuiControlGet, Start
if (Start) {
    SendInput, 123456789
    SetTimer, MyLabel, -1000 ; Negative numbers cause the timer to run only once
}
return
 
GuiClose:
ExitApp
TheBrohman
Posts: 13
Joined: 07 Dec 2015, 12:31

Re: Need help with my script

08 Dec 2015, 06:38

Thanks this worked, Kon :)

Return to “Ask For Help”

Who is online

Users browsing this forum: Rohwedder, terenceck, woo and 153 guests