Make my mouse move whenever my variable is above 0

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
mykuledillon
Posts: 1
Joined: 24 Sep 2022, 11:12

Make my mouse move whenever my variable is above 0

Post by mykuledillon » 24 Sep 2022, 11:15

I've used AutoHotKey on and off over the last 6 years, and right now I want to make a script that actually works.

Code: Select all

MyVar:=0
MyVar=true
Numpad2:: loop {
	if (MyVar > 0) {
		MouseMove, 0, -150, 75, R;
	}
}


space::Click, Down;
<!a:: MyVar := 1
Numpad0:: MyVar := 0
Numpad1:: Msgbox The value in the variable is %MyVar%.
My goal here is to make my mouse move whenever my variable is above 0, but I can't seem to figure out if statements. I tried using an if statement without a hotkey, but it doesn't seem to want to work either way. I'm not looking for a toggle or anything, I just want my script to do what I want it to do.
Last edited by BoBo on 24 Sep 2022, 12:45, edited 1 time in total.
Reason: Changed subject line from "I would like some help with a really simple expression" to "Make my mouse move whenever my variable is above 0" to be more specific.

BoBo
Posts: 6564
Joined: 13 May 2014, 17:15

Re: Make my mouse move whenever my variable is above 0

Post by BoBo » 24 Sep 2022, 15:36

Code: Select all

MyVar:=0

Numpad2:: 
loop {
	if (MyVar > 0) {
		MouseMove, 0, -150, 75, R
	}
}

space::Click, Down
<!a:: MyVar := 1
Numpad0:: MyVar := 0
Numpad1:: Msgbox % "The value in the variable is " . MyVar
Not tested.
Don't use that JS'ish line ending;

Post Reply

Return to “Ask for Help (v1)”