Page 1 of 1

Using SendKeys to unlock the keyboard shift state

PostPosted: Sun Dec 28, 2014 6:50 pm
by Enigman
I have an application that uses SendKeys to transmit usernames and passwords to websites. I have noticed that if the physical keyboard shift lock is on, then all transmitted characters are sent as upper case even though what I am sending is lower case.

I have not seen a key code that works against the shift lock. I have tried the {Shiftup} and {ShiftDn] codes and they have no effect on the lock status.

Does anyone know how I can turn off the shift lock prior to using SendKeys or as a part of the string of SendKeys codes?

And why on earth does the shift lock override the Sendkeys command content?

Thanks.

Re: Using SendKeys to unlock the keyboard shift state

PostPosted: Sun Dec 28, 2014 8:08 pm
by Tony Kroos
And why on earth does the shift lock override the Sendkeys command content?

Because it doesn't send text strings like you type it in SendKeys parameters. It sends system messages emulating keyboard key press events, and results may vary, depending on current keyboard and key status, active layout, etc...
I have tried the {Shiftup} and {ShiftDn] codes and they have no effect on the lock status.

Check OS keyboard settings (sticky keys options maybe?) and/or keyboard manual to find out which key press disables shiftlock, or maybe you should press shift and hold it for some specified time before releasing...

Re: Using SendKeys to unlock the keyboard shift state

PostPosted: Sun Dec 28, 2014 8:43 pm
by Enigman
Check OS keyboard settings (sticky keys options maybe?) and/or keyboard manual to find out which key press disables shiftlock, or maybe you should press shift and hold it for some specified time before releasing...

Uh ... what? This is on a laptop. No keyboard manual. Besides, what I am looking for is something specific to Neobook to disable the shift lock using SendKeys. Something undocumented maybe like {ShiftLockOff}, or an ascii number combination. No laptop or desktop manual or OS settings are going to document what to use with the Neobook Sendkeys command. I'm looking for something someone may have discovered that does it. Or a chime in from Dave?

Thanks.

Re: Using SendKeys to unlock the keyboard shift state

PostPosted: Mon Dec 29, 2014 12:04 am
by CN_Iceman
Hi...

The rtFileSystemMgt Plug-In Library (rtFSM) has some interesting features to control the keyboard.

- rtGetCapsLock (Check CapsLock status)
- rtSetCapsLockOFF (Set the Caps Lock to Off mode)
- rtSetCapsLockON (Set the Caps Lock to ON mode)
- rtGetNumLock (Check Num Lock status)
- rtSetNumLockOFF (Set the Num Lock to Off mode)
- rtSetNumLockON (Set the Num Lock to ON mode)
- rtGetScrollLock (Check the Scroll Lock status)
- rtSetScrollLockOFF (Set the Scroll Lock to Off mode)
- rtSetScrollLockON (Set the Scroll Lock to ON mode)

The Plugin is distributed as SHAREWARE, and is available on evaluation for 30 days trial period.

Re: Using SendKeys to unlock the keyboard shift state

PostPosted: Mon Dec 29, 2014 9:01 am
by Enigman
The Plugin is distributed as SHAREWARE, and is available on evaluation for 30 days trial period.

Thanks for that pointer. I'll keep that in mind.

Still looking for a way to do it in native NB.

Thanks.

Re: Using SendKeys to unlock the keyboard shift state

PostPosted: Mon Dec 29, 2014 11:11 am
by dpayer

Re: Using SendKeys to unlock the keyboard shift state

PostPosted: Mon Dec 29, 2014 12:24 pm
by Enigman

:-) Thanks for that pointer, but I am not going to tell my customers to perform a registry change just to solve this issue. I am not looking for a permanent disabling of the shift lock. I looking for a native NB programatic way to turn off the lock before a username and password are transmitted with SendKeys.

Thanks.

Re: Using SendKeys to unlock the keyboard shift state

PostPosted: Mon Dec 29, 2014 12:31 pm
by Neosoft Support
You might be able to turn off the caps lock with a VBScript function:

https://www.google.com/webhp?q=vbscript+turn+off+capslock

Re: Using SendKeys to unlock the keyboard shift state

PostPosted: Mon Dec 29, 2014 4:44 pm
by Garic
ksCapsLockStatus
ksCapsLockPush
You can also use commands from ksFunctions plugin to check the status mode CapsLock, and turn it on or off as needed.
The only but - Plugin has Russian interface .

Re: Using SendKeys to unlock the keyboard shift state

PostPosted: Mon Dec 29, 2014 7:14 pm
by Enigman
Neosoft Support wrote:You might be able to turn off the caps lock with a VBScript function:

https://www.google.com/webhp?q=vbscript+turn+off+capslock

After looking at the results of the above search I saw a code string of {CapsLock}. It turns out that the code is supported by the Neobook SendKeys command. However, it is a toggle and not an off switch. So you send it once and caps lock is toggled to the opposite state. Send it again and it is toggled again. That is no good without status detection. Additional searches for determining the status of the caps lock using VBScript shows that no one really knows a viable way to check the status using VBScript, at least not published. The only script seen requires that MS Word be preloaded on the target computer. Can't use that.

I know there is a plug-in that will check the status, but I prefer not to be dependant on someone's plug-in for this. Has anyone found a way to check the status either in VBScript as a function or in native Neobook?

Thanks.

Re: Using SendKeys to unlock the keyboard shift state

PostPosted: Tue Dec 30, 2014 4:02 am
by dec
Hello,

Just to add another way:

* npGetKeyboardLockKeys

* npSetKeyboardLockKeys

Re: Using SendKeys to unlock the keyboard shift state

PostPosted: Tue Dec 30, 2014 12:31 pm
by dpayer
Enigman wrote:
Neosoft Support wrote:You might be able to turn off the caps lock with a VBScript function:

https://www.google.com/webhp?q=vbscript+turn+off+capslock

After looking at the results of the above search I saw a code string of {CapsLock}. It turns out that the code is supported by the Neobook SendKeys command. However, it is a toggle and not an off switch. So you send it once and caps lock is toggled to the opposite state. Send it again and it is toggled again. That is no good without status detection.
Thanks.


You could do your own status detection by sending a keystroke to a hidden text field and then checking the results with the CASE SENSITIVE option of SearchStr ( a native NB command).

Re: Using SendKeys to unlock the keyboard shift state

PostPosted: Tue Dec 30, 2014 6:50 pm
by Enigman
You could do your own status detection by sending a keystroke to a hidden text field and then checking the results with the CASE SENSITIVE option of SearchStr ( a native NB command).

Okay ... that works. I placed a text input box off stage and called it CaseCheck with a variable name of [CaseCheck]. The program initializes it blank on startup just to be sure. I made it so that if the caps lock was on for some reason, I turn it off to do the transmitting, then turn it back on. If it was off first, then nothing extra is done.

Here's how it codes out:

Code: Select all
. Find out if caps lock is on
FocusObject "CaseCheck"
SendKeys "" "a"
SearchStr "A" "[CaseCheck]" "[CapOffset]" "CaseSensitive"
IfEx "[CapOffset] > 0"
     . Caps lock is on, turn it off
     SendKeys "" "{CapsLock}"
EndIf

. Do transmitting stuff here...

IfEx "[CapOffset] > 0"
     . Caps lock was on, turn it back on
     SendKeys "" "{CapsLock}"
EndIf
SetVar "[CaseCheck]" ""

The trailing SetVar to clear the box is very important. Otherwise the test will be inaccurate on the second usage.

I always prefer native NB solutions over plug-ins unless I write the plug-in myself (which I haven't tried yet). I've had some bad experience where my program outlived the plug-in support and I lost a critical function that ended up killing my program viability.

Thanks.