Hold down a key with a key combination

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
nesife4997
Posts: 3
Joined: 16 Sep 2021, 00:33

Hold down a key with a key combination

16 Sep 2021, 01:14

When I press the 1 key, I need to execute a script that includes a keys combination
The combination is this, when I press the 1 key, I need to hold down the Shift key and press the W key, after which the Shift key is released

All this should work in a certain window, I tried to make a script, but it does not work for me as expected, feeling that the Shift key is not hold

Code: Select all

#SingleInstance
#InstallKeybdHook
#InstallMouseHook

SetTimer, MoveTimer, 16
return

MoveTimer:
IfWinActive, *window name*
{
    GetKeyState, state, 1
    if state = D
    {
        Send {Shift down}		
        Send W
        Send {Shift up}	
}
}
return
nesife4997
Posts: 3
Joined: 16 Sep 2021, 00:33

Re: Hold down a key with a key combination

16 Sep 2021, 02:02

I seem to have done it, but now you need to make it so that the left mouse button is disabled during the execution of the script
can you help?

Code: Select all

#SingleInstance
#InstallKeybdHook
#InstallMouseHook

SetTimer, MoveTimer, 16
return

MoveTimer:
IfWinActive, Titan Quest Anniversary Edition
{
    GetKeyState, state, 1
    if state = D
    {  
	Loop, 1
		{
		Sleep, 531
		Send, {Blind}{Space Down}w
		Sleep, 800
		Send, {Space Up}
		}
 }
}
return

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: No registered users and 140 guests