Alf
Alf

Reputation: 1295

AutoHotKey => assign key combination to key combination

I use Alt+J/K/L/I instead of Left/Down/Right/Up keys. It's straightforward:

!k::Send {Down Down}

Now I decided to add Shift to this sequence and use it to expand selection Left/Down... I tried difference ways, read multiple posts - nothing helps. For example this:

!k:: 
if GetKeyState("Shift")
{
        Send {+Down Down}
        return
}
else
{
    Send {Down Down}
}
return

Or this:

!k::
    If GetKeyState("Shift")
        Send {+Down Down}
    Else
        Send {Down Down}
Return

What's wrong?

Upvotes: 0

Views: 2111

Answers (1)

Robert Ilbrink
Robert Ilbrink

Reputation: 7973

You have to tell your HotKey to "Accept" other modifiers by adding an *.
Otherwise Shift+Alt+k will be ignored (unless you place a +!k:: above the !k::.

*!k:: 
if GetKeyState("Shift","P")
{
        ;ToolTip, Shift
        Send {+Down Down}
        return
}
else
{
    ;ToolTip, Normal
    Send {Down Down}
}
return

Upvotes: 1

Related Questions