Seems to never work.

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
VATwitch

Seems to never work.

12 Jan 2016, 16:17

Seems like I ever use the key:: function my script doesn't work at all..

For instance.

My code:

Code: Select all

NumpadAdd::
Loop
	{
		If A_Index = 1
			Sleep, 500
		GetKeyState, State, NumpadAdd, down
		If State = up
			Break
		MouseClick, right
		Send {Down}
		Sleep 10
		Send {Down}
		Sleep 10
		Send {Enter}
		Sleep 10
		Send {Enter}
	}
Sleep, 500
Return
It's supposed to spam poke on TeamSpeak 3.

Removing the NumpadAdd:: and removing the key state, leaving just the loop for sending mouseclick, etc. Works. What am I doing wrong?
Shadowpheonix
Posts: 1259
Joined: 16 Apr 2015, 09:41

Re: Seems to never work.

12 Jan 2016, 18:05

Two issues with your code...
First, "down" is not a valid mode for GetKeyState. Valid Modes are blank for logical state, "P" for physical state, and "T" for toggle state. See the documentation for more detail.
Second, GetKeyState returns either "U" for Up or "D" for down. It does not return the actual word "up".

Here are the corrected lines you need in your script...

Code: Select all

		GetKeyState, State, NumpadAdd, P
		If State = U

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: No registered users and 373 guests