I can't tell you the reason for this, but its due to Lshift being the first modifier and sending the Ctrl key.
The send command trips out AHK and it sees the shift key as being both logically AND PHYSICALLY up. That sort of hotkey forces the installation of the keyboard hook as well.
If the hotkey definition was the other way around, that is, LAlt & LShift, then after the send {Ctrl} AHK would see the alt key as physically and logically up.
This will work as you expect.
Code: Select all
LShift & LAlt:: Send {a}
LShift & LAlt Up:: Send {a Up}
I've noticed some other odd behaviours with hotkeys and modifiers before.
This hotkey may work as intended or close to it.
Code: Select all
#Persistent
#SingleInstance force
SetBatchLines, -1
#InstallMouseHook
#InstallKeybdHook
#UseHook On
LAlt & LShift::
LShift & LAlt::
Send {BLIND}{Ctrl Down}{LShift UP}{LAlt UP}
; This must be an ||/or as getting the state
; For LAlt & LShift:: Left shift is seen as physically down, but Left alt is UP!
; For LShift & LAlt:: Left alt is seen as physically down, but Left shift is UP!
; It is the send command of the modifiers above which causes this.
; Note although this is an OR you still need to hold both hotkeys down
; if you intiated the hotkey via LAlt & LShift::
; I could probably change this behaviour, but I believe this is what you want anyway.
while GetKeyState("Shift", "P") || GetKeyState("Alt", "P")
{
; ================================================================
; Remove this tooltip - ITs just here to demonstrate the issue
; ================================================================
tooltip % A_Index
. "`n" GetKeyState("LShift", "P") " | " GetKeyState("LShift")
. "`n" GetKeyState("LAlt", "P") " | " GetKeyState("LAlt")
; ================================================================
; Remove this tooltip - ITs just here to demonstrate the issue
; ================================================================
sleep 15
}
send {Ctrl Up}
; for increased security consider using Send {BLIND}{LShift UP}{LAlt UP}{Ctrl UP} ; may not be required.
return
Or even better using your method: Not only is it clearer, but the hotkey should end if you release either shift or alt.
Code: Select all
#Persistent
#SingleInstance force
SetBatchLines, -1
#InstallMouseHook
#InstallKeybdHook
#UseHook On
LShift & LAlt:: Send {BLIND}{Ctrl Down}{LShift UP}{LAlt UP}
LShift & LAlt Up:: Send {BLIND}{Ctrl Up}
LAlt & LShift:: Send {BLIND}{Ctrl Down}{LShift UP}{LAlt UP}
LAlt & LShift Up:: Send {BLIND}{Ctrl Up}