CapsLock plus Shift

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
autoday
Posts: 16
Joined: 05 Apr 2017, 11:58

CapsLock plus Shift

12 Dec 2018, 23:40

Hello,

I Have code like this:

SetCapsLockState AlwaysOff

; Toggle Capslock with alt-Capslock.
!CapsLock::CapsLock

CapsLock & x::
If GetKeyState("Shift", "P")
Send, {BackSpace}
Else
Send, {Delete}
return

But it is not working ,in case of Caps Lock + Shift Condition.

Please Help for this code
Regards
Rohwedder
Posts: 7672
Joined: 04 Jun 2014, 08:33
Location: Germany

Re: CapsLock plus Shift

13 Dec 2018, 02:27

Hallo,
I don't know exactly what you want to do but there is a difference between the state of Capslock key and the CapslockState.
Try:

Code: Select all

#Persistent
SetTimer, KeyState, 200
!CapsLock:: ; Toggle CapslockState with alt-Capslock.
If GetKeyState("CapsLock", "T")
	SetCapsLockState, Off
Else
	SetCapsLockState, On
Return
KeyState: ;0/1 = Up/Down
MouseGetPos, TX, TY
ToolTip,%
( Join
` "Capslock key state: " GetKeyState("Capslock")
` "`nCapslockState: " GetKeyState("CapsLock", "T")
` "`nShift key state: " GetKeyState("Shift")
,TX+16,TY+32
)
Return
autoday
Posts: 16
Joined: 05 Apr 2017, 11:58

Re: CapsLock plus Shift

13 Dec 2018, 09:08

Hello,
Sorry for not clear.

I want Caps+Shift +x == Backspace
and
Caps+x == Delete

Also

Caps+Shift +d == Ctrl+Backspace
and
Caps+d== Ctrl+Delete

Regards
Rohwedder
Posts: 7672
Joined: 04 Jun 2014, 08:33
Location: Germany

Re: CapsLock plus Shift

13 Dec 2018, 10:48

Hallo,
if I press Caps + LShift + x at the same time, my autohotkey only notice Caps + LShift.
Try this script, maybe your hardware can do more.

Code: Select all

#Persistent
#InstallKeybdHook
#InstallMouseHook
SetTimer, KeyCombination, 100
KeyCombination:
ToolTip, % KeyCombination()
Return
KeyCombination(ExcludeKeys:="")
{
    ExcludeKeys .= "{Shift}{Control}{Alt}{WheelUp}{WheelDown}"
    Loop, 0xFF
    {
        Key := Format("VK{:02X}",0x100-A_Index)
        IF !GetKeyState(Key,"P")
            Continue        
        Key := "{" GetKeyName(Key) "}"
        If !InStr(ExcludeKeys,Key)
            KeyCombination .= Key
    }
    Return, KeyCombination
}
Return
But Caps + LShift + d works here!
Try:

Code: Select all

SetCapsLockState AlwaysOff
Capslock & d::
IF GetKeyState("Shift","P")
	Send, ^{Bs}
Else
	Send, ^{Del}
Return
autoday
Posts: 16
Joined: 05 Apr 2017, 11:58

Re: CapsLock plus Shift

13 Dec 2018, 20:33

Yes you are right.
Caps + LShift + x not working but Caps + LShift + d works OK.

Thanks for help.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Google [Bot], jollyjoe, mikeyww and 328 guests