Assign two command to one key. Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
zerox
Posts: 77
Joined: 15 Apr 2021, 13:01

Assign two command to one key.

15 Apr 2021, 13:08

Hello!
I wanna this "press 9" then "press left click" when i press the "q" key.
So normally i have to press 9 then clicking, and i want this two in one key. Thx.
Rohwedder
Posts: 7613
Joined: 04 Jun 2014, 08:33
Location: Germany

Re: Assign tow command to one key.

15 Apr 2021, 13:24

Hallo,
try:

Code: Select all

#InputLevel 1
q::9
#InputLevel 0
~9::LButton
zerox
Posts: 77
Joined: 15 Apr 2021, 13:01

Re: Assign tow command to one key.

15 Apr 2021, 13:39

Hello!
Thanks your answer!
I created this

Code: Select all

q::
send {9}
sleep 500
send {Lbutton}
and sometimes working, mostly not. 80% of the time not working. Same with yours.

And what if i set hol left button instead of click? Do yo know how to do it?
Last edited by joedf on 15 Apr 2021, 13:43, edited 1 time in total.
Reason: added [code] tags
zerox
Posts: 77
Joined: 15 Apr 2021, 13:01

Re: Assign tow command to one key.

15 Apr 2021, 14:04

Sorry, i forget something. So i need 3 command. "press ESC" + "press 9" + "press left click" or "hold left click" (i wanna try both) .
I will really appreciate any help.
zerox
Posts: 77
Joined: 15 Apr 2021, 13:01

How to assign 3 command to one button?

20 Apr 2021, 05:12

Code: Select all

q::
send {Esc}
send {9}
sleep 10
send {Click, Down}
So is it wrok, but the program wont stop if i release the "q" key. I want this command to run, only when i hol "q", thx for any help!
Rohwedder
Posts: 7613
Joined: 04 Jun 2014, 08:33
Location: Germany

Re: Assign tow command to one key.

20 Apr 2021, 06:42

perhaps:

Code: Select all

q::
While, GetKeyState("q", "P")
{
	send {Esc}
	send {9}
	sleep 10
	send {Click, Down}
}
send {Click, Up}
Return
zerox
Posts: 77
Joined: 15 Apr 2021, 13:01

Re: Assign tow command to one key.

20 Apr 2021, 11:04

Rohwedder wrote:
20 Apr 2021, 06:42
perhaps:

Code: Select all

q::
While, GetKeyState("q", "P")
{
	send {Esc}
	send {9}
	sleep 10
	send {Click, Down}
}
send {Click, Up}
Return
Yeah, this is working fine, instead of when i hold the shift in the same time. Do u have any idea why?
Rohwedder
Posts: 7613
Joined: 04 Jun 2014, 08:33
Location: Germany

Re: Assign two command to one key.  Topic is solved

20 Apr 2021, 14:39

Hotkey q:: triggers when the q key is pressed without modifier. Modifiers are Ctrl, Shift Win and Alt. Hotkey *q:: also triggers together with modifiers.

Code: Select all

*q::
While, GetKeyState("q", "P")
{
	send {Blind}{Esc}
	send {Blind}{9}
	sleep 10
	send {Blind}{Click, Down}
}
send {Blind}{Click, Up}
Return
zerox
Posts: 77
Joined: 15 Apr 2021, 13:01

Re: Assign two command to one key.

21 Apr 2021, 09:24

Rohwedder wrote:
20 Apr 2021, 14:39
Hotkey q:: triggers when the q key is pressed without modifier. Modifiers are Ctrl, Shift Win and Alt. Hotkey *q:: also triggers together with modifiers.

Code: Select all

*q::
While, GetKeyState("q", "P")
{
	send {Blind}{Esc}
	send {Blind}{9}
	sleep 10
	send {Blind}{Click, Down}
}
send {Blind}{Click, Up}
Return
The previous worked better, this one never working while i hold shift , and sometimes i have to hold the shift in the game. Nvm, i gave up, thx so much for tried to help, i gave ok for both.
Rohwedder
Posts: 7613
Joined: 04 Jun 2014, 08:33
Location: Germany

Re: Assign two command to one key.

21 Apr 2021, 09:41

Then try it without blind mode!

Code: Select all

*q::
While, GetKeyState("q", "P")
{
	send {Esc}
	send {9}
	sleep 10
	send {Click, Down}
}
send {Click, Up}
Return
zerox
Posts: 77
Joined: 15 Apr 2021, 13:01

Re: Assign two command to one key.

22 Apr 2021, 07:16

Rohwedder wrote:
21 Apr 2021, 09:41
Then try it without blind mode!

Code: Select all

*q::
While, GetKeyState("q", "P")
{
	send {Esc}
	send {9}
	sleep 10
	send {Click, Down}
}
send {Click, Up}
Return
Same. And what if click once? Can we try it?
Rohwedder
Posts: 7613
Joined: 04 Jun 2014, 08:33
Location: Germany

Re: Assign two command to one key.

22 Apr 2021, 11:00

Try it!

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: No registered users and 245 guests