Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

Real Pressing Caps Lock


  • Please log in to reply
4 replies to this topic
wyw
  • Members
  • 32 posts
  • Last active: Aug 01 2017 10:16 AM
  • Joined: 01 Jul 2015

What's the script that activates the caps lock like you'd press it on the keyboard?



Masonjar13
  • Members
  • 1517 posts
  • Last active:
  • Joined: 16 Sep 2012

sendInput {CapsLock}

OS: Windows 7 Ultimate / Windows 8.1 Pro | Editor: Notepad++


wyw
  • Members
  • 32 posts
  • Last active: Aug 01 2017 10:16 AM
  • Joined: 01 Jul 2015
sendInput {CapsLock}

Okay nice, could you change the script that put the caps lock automatically off once the next key (next key after caps) has been pressed? Something simliar like this (not working caps lock):

 

#NoEnv
#Persistent
SetKeyDelay, -1
x := True ; start off script with an assumed capital (true)

Loop
{    Input, key, C I L1 V
    TOOLTIP
% X GetKeyState("CapsLock",T)
    if( x && RegExMatch(key,"[a-z]") && !GetKeyState("CapsLock","T"))
    {
        SetCapsLockState, On
        Send {Backspace}+%key%
    }
    else if (x && GetKeyState("CapsLock","T"))
    {
        SetCapsLockState, Off
        If RegExMatch(key,"[A-Z]")
            Send % "{Backspace}" Chr(Asc(key)+32)
        x:= False
    }
    else if InStr(".?!", key)
        x := True
}



Masonjar13
  • Members
  • 1517 posts
  • Last active:
  • Joined: 16 Sep 2012

What's not working about it? I replaced both SetCapsLockState commands with SendInput.

#NoEnv
#Persistent
SetKeyDelay, -1
x := True ; start off script with an assumed capital (true)
Loop
{    Input, key, C I L1 V
    TOOLTIP % X GetKeyState("CapsLock",T)
    if( x && RegExMatch(key,"[a-z]") && !GetKeyState("CapsLock","T"))
    {
        sendInput {CapsLock}
        Send {Backspace}+%key%
    }
    else if (x && GetKeyState("CapsLock","T"))
    {
        sendInput {CapsLock}
        If RegExMatch(key,"[A-Z]")
            Send % "{Backspace}" Chr(Asc(key)+32)
        x:= False
    }
    else if InStr(".?!", key)
        x := True
}

OS: Windows 7 Ultimate / Windows 8.1 Pro | Editor: Notepad++


wyw
  • Members
  • 32 posts
  • Last active: Aug 01 2017 10:16 AM
  • Joined: 01 Jul 2015

 

What's not working about it? I replaced both SetCapsLockState commands with SendInput.

#NoEnv
#Persistent
SetKeyDelay, -1
x := True ; start off script with an assumed capital (true)
Loop
{    Input, key, C I L1 V
    TOOLTIP % X GetKeyState("CapsLock",T)
    if( x && RegExMatch(key,"[a-z]") && !GetKeyState("CapsLock","T"))
    {
        sendInput {CapsLock}
        Send {Backspace}+%key%
    }
    else if (x && GetKeyState("CapsLock","T"))
    {
        sendInput {CapsLock}
        If RegExMatch(key,"[A-Z]")
            Send % "{Backspace}" Chr(Asc(key)+32)
        x:= False
    }
    else if InStr(".?!", key)
        x := True
}

Well, the caps lock doesn't go away after it has been used already.