Hotstrings with modifier keys Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
rscott
Posts: 3
Joined: 20 Jun 2018, 13:55

Hotstrings with modifier keys

20 Jun 2018, 14:13

I want to set up a series of scripts that operate similar to the way entering unicode characters work in windows, when you press alt + and then the 4 digit code on the numpad for that character, except I want to use the left control key and a 4 digit sequential combination on the numpad to output a text string. How would I do this? The hotstring command on its own does not appear to accept modifiers like control as a valid key.
Rohwedder
Posts: 7616
Joined: 04 Jun 2014, 08:33
Location: Germany

Re: Hotstrings with modifier keys

21 Jun 2018, 02:44

Hallo,
you certainly don't want to lose the function of left control key!
Here with Capslock:

Code: Select all

#IF GetKeyState("CapsLock","P")
:?*X:1234::
	SendInput, Hallo World
	KeyWait, CapsLock
	Send {CapsLock} ;Resets CapsLockState
#If
if you never need the Capslockstate:

Code: Select all

CapsLock::Return
#IF GetKeyState("CapsLock","P")
:?*:1234::Hallo World
#If
rscott
Posts: 3
Joined: 20 Jun 2018, 13:55

Re: Hotstrings with modifier keys

21 Jun 2018, 09:41

my plan was to use a #IfWinActive function to restrict the script to the application I need to script these functions for, control is not really used natively in that application.
User avatar
Masonjar13
Posts: 1555
Joined: 20 Jul 2014, 10:16
Location: Не Россия
Contact:

Re: Hotstrings with modifier keys

21 Jun 2018, 10:48

You can use both.

Code: Select all

#if getKeyState("CapsLock","P") && winActive("WinTitle")
OS: Windows 10 Pro | Editor: Notepad++
My Personal Function Library | Old Build - New Build
Rohwedder
Posts: 7616
Joined: 04 Jun 2014, 08:33
Location: Germany

Re: Hotstrings with modifier keys  Topic is solved

21 Jun 2018, 11:23

Hallo,
here with left control key only for Notepad:

Code: Select all

#If WinActive("ahk_class Notepad")
LCtrl::Return
#IF GetKeyState("LCtrl","P") && WinActive("ahk_class Notepad")
:?*:1234::Hallo World
#If
rscott
Posts: 3
Joined: 20 Jun 2018, 13:55

Re: Hotstrings with modifier keys

21 Jun 2018, 12:47

Rohwedder wrote:Hallo,
here with left control key only for Notepad:

Code: Select all

#If WinActive("ahk_class Notepad")
LCtrl::Return
#IF GetKeyState("LCtrl","P") && WinActive("ahk_class Notepad")
:?*:1234::Hallo World
#If
This will work out great. Thanks a ton.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Google [Bot], OrangeCat, scriptor2016 and 113 guests