Send Multiple Key On 1 Hotkey

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
pektusan
Posts: 3
Joined: 22 Jun 2018, 20:56

Send Multiple Key On 1 Hotkey

22 Jun 2018, 21:42

would anyone please help me,

i am planning to make a hotkey but sending 3 different keys

like this

$~LButton::1 / Send 1
$~LButton::r / Send r
$~LButton::r / Press R For a Few Sec

is this possible?

Thanks in Advance
Rohwedder
Posts: 7627
Joined: 04 Jun 2014, 08:33
Location: Germany

Re: Send Multiple Key On 1 Hotkey

23 Jun 2018, 11:50

Hallo,
this:

Code: Select all

$~LButton::1
is a Remapping (with an unnecessary $), not a Hotkey!
Do you want something like this Hotkey?

Code: Select all

~*LButton::
	Send 1
	Send r
	Send {Shift Down}{r Down}
	KeyWait, LButton
	Send {r Up}{Shift Up}
Return
pektusan
Posts: 3
Joined: 22 Jun 2018, 20:56

Re: Send Multiple Key On 1 Hotkey

23 Jun 2018, 19:30

first of all thanks for the help.

first 2 are working good

but my problem is when i press the Lbutton 3rd Time it wont Hold The KeyDown.

im working on something like:

when i press Lbutton it will send 1, then 2nd time i press it will send r, then 3rd time it will hold down the 3 button until i release the Lbutton.

is this possible?

also i want to put interval like 10 seconds holding down the send 1 button.

sorry for my bad english.
Rohwedder
Posts: 7627
Joined: 04 Jun 2014, 08:33
Location: Germany

Re: Send Multiple Key On 1 Hotkey

24 Jun 2018, 01:12

Hallo,
try this (also to understand!):

Code: Select all

~*LButton::
	Counter:=Mod(0 Counter+1,4) ;counts: 0,1,2,3,0,1,2...
	If Counter = 0
		Send 1
	Else If Counter = 1
		Send r
	Else If Counter = 2
	{ ;holding button 3 until Lbutton is released
		Send {3 Down}
		KeyWait, LButton
		Send {3 Up}
	}
	Else ;Counter = 3
	{ ;10 seconds holding button 1
		Send {1 Down}
		SetTimer 1Up, -10000 ;10000ms non-periodic
	}
Return
1Up:
	Send {1 Up}
Return
pektusan
Posts: 3
Joined: 22 Jun 2018, 20:56

Re: Send Multiple Key On 1 Hotkey

24 Jun 2018, 03:33

~*LButton::
Counter:=Mod(0 Counter+1,4) ;counts: 0,1,2,3,0,1,2...
If Counter = 0
Send 1
Else If Counter = 1
Send r
Else If Counter = 2
{ ;holding button 3 until Lbutton is released
Send {r Down}
KeyWait, LButton
Send {r Up}
}
Else ;Counter = r
{ ;10 seconds holding button 1
Send {1 Down} <----- What Are This For?
SetTimer 1Up, -10000 ;10000ms non-periodic
}
Return
1Up:
Send {1 Up} <----- What Are This For?
Return

Thank You Very Much Sir.
Finally Its Working, but i have a few Questions, sorry im still new.
Rohwedder
Posts: 7627
Joined: 04 Jun 2014, 08:33
Location: Germany

Re: Send Multiple Key On 1 Hotkey

24 Jun 2018, 08:13

Hallo,
10 seconds holding button 1, means:
"Send {1 Down}", "Wait 10 seconds", "Send {1 Up}".
Here, "Wait 10 seconds" and "Send {1 Up}" was performed by a non-periodic timer with the label "1Up".
https://autohotkey.com/docs/commands/SetTimer.htm

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Descolada, Joey5, mikeyww, RandomBoy, wpulford and 338 guests