Send multiple keys?

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
garretthylltun
Posts: 4
Joined: 28 Dec 2013, 16:34

Send multiple keys?

28 Dec 2013, 20:37

Greetings and thanks in advance for any info,

Help file leaves me confused. I want to send LCtrl + LShift + ~ to a specific window and then wait like 10 milliseconds and then send a string of text, wait another 10 milliseconds and then send the Enter key. My problem is that the help file leaves me a bit confused on sending multiple keys at once. Do I send it just like this:

Code: Select all

Send ahk_class ClassName {LCtrl}{LShift}~
Thanks,
~Garrett
User avatar
FanaticGuru
Posts: 1907
Joined: 30 Sep 2013, 22:25

Re: Send multiple keys?

28 Dec 2013, 21:20

There are two methods for sending a key with modifiers held down.

If only one key is getting sent then you can use the modifier symbols ! + ^ #

If more than one key needs to be sent with modifiers held down or you need to indicate left or right modifiers than you can use the Down and Up options after the names of the modifier keys.

I commented out the Down/Up method in the script below.

Code: Select all

SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.

f1::
	StringofText := "Some Text to Send"
	Send ^+~	; Holds down Control ^ and Shift + while sending ~ (!+^# only affect 1 character before they are released)
;	Send {LCtrl Down}{LShift Down}~{LCtrl Up}{LShift Up}  ; Could be any number of keys between the Down and Up
	Sleep 10
	Send % StringofText
	Sleep 10
	Send {Enter}
return
FG
Hotkey Help - Help Dialog for Currently Running AHK Scripts
AHK Startup - Consolidate Multiply AHK Scripts with one Tray Icon
Hotstring Manager - Create and Manage Hotstrings
[Class] WinHook - Create Window Shell Hooks and Window Event Hooks
Wade Hatler
Posts: 60
Joined: 03 Oct 2013, 19:49
Location: Seattle Area
Contact:

Re: Send multiple keys?

30 Dec 2013, 15:20

Good explanation. The only thing I would add is that if the string of text might contain anything that could be a special character, such as ^!#+{}, the second Send should really be a SendRaw, which sends the string as raw text without special processing , or Send {Raw} which disables special processing for the remainder of that Send command.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Leonardo_Portela, redgum and 179 guests