send "keyUp" / "rawKeyUp" ?

Mike Bonner bonnmike at gmail.com
Sun Feb 25 11:26:19 EST 2018


Hmm.  On linux you might be able to use a shell command to get some info,
though I don't know enough about theh output to be much help.

the command xkbcom :0 - dumps a truckload of info, might be useful for your
task.
I'm guessing there is a way to do this on macos too but I don't currently
have access to a mac.
Unsure about how to go about it on windows.

For example, on my system one of the first lines contains qwerty as part of
the line.  The only issue with this, is that custom mapings are possible,
though it looks like the aliases are part of the information.

I've seen operating systems do the "press the key to the right of the left
shift key.." sequence to determine base layout (which again, wouldn't cover
every base if the user has changed the keyboard map, so you might need to
have them press every key...  xkbcom might get around that if you can
figure out enough to interpret the results)



On Sun, Feb 25, 2018 at 8:22 AM, Richmond Mathewson via use-livecode <
use-livecode at lists.runrev.com> wrote:

> Either I did not explain things very well or you got hold of the wrong end
> of the stick
> (or, most probably a bit of both: probably the latter as a consequence of
> the former).
>
> Imagine, if you will, I need to know what an end-user's standard keyboard
> layout is.
> Let's call our theoretical end-user Farhad, and Iranian who uses an
> Iranian keyboard layout
> (something I don't know), and let's call our me Richmond owing to a slight
> lack of imagination
> on my part; and I use a US English keyboard layout, which I know, but
> isn't useful information
> under the circumstances.
>
> Now if I click on the key that yields a rawKey of 113 I get a "q".
>
> If Farhad clicks on the key that yields a rawKey of 113 he gets a "ق
>
> And I am unable to type close-quotes there.
>
> So I should like to find a way to fake someone pressing down on a key on
> their home-computer
> to see what the keyUp result is.
>
> Now I realise I cannot SEND a command telling the key on the keyboard to do
> "a pianola" and depress itself (wouldn't that be fun?).
>
> It would, however, be groovy if one could work out Farhad's keys without
> having him to
> go "bash, bash" all the way along the rows of his keyboard.
>
> Richmond.
>
>
>
> On 25/2/2018 4:13 pm, Mike Bonner via use-livecode wrote:
>
>> A quick example placed in the card script.
>>
>> local sKeysPushed --keys kept in this variable for the example
>>
>> on rawkeydown pkey
>>     if sKeysPushed is empty then
>>        put pkey into sKeysPushed
>>     else
>>        put comma & pkey after sKeysPushed
>>     end if
>>
>> -- You would want to remove this block of course, but for testing
>> -- it lets you push the shift key to see whats been captured
>>     if the shiftkey is down then
>>        put sKeysPushed
>>     end if
>>
>>     pass rawkeydown --pass the key
>>
>> end rawkeydown
>>
>> I know it was just pseudocode, but as far as I know you can't "send" a
>> message to a key so..
>> If you want to be able to click a button to send a rawkeydown (rather than
>> just typing them) you could use something like:
>>
>> on mouseup
>>       send "rawkeydown 110" to this card
>> end mouseup
>>
>> or
>> on mouseup
>>       displatch "rawkeydown" with (any item of "119,240,43") --<list of
>> random keys to send
>> end mouseup
>>
>> Now.. If you need to track keypresses while NOT actively using your
>> application, it requires a different method.  You'd need to use a
>> different
>> method.  You would need to use a send loop and check the keysdown and
>> build
>> up your keys list that way.  Using this method would be problematic
>> though,
>> for example.. A user holds a key down long enough for several loops to
>> happen, so the keysdown would show the key multiple times.  Which might be
>> appropriate if autorepeat is being used, but then you have no idea how
>> many
>> "repeats" there were because its based on the repeat rate.  It would be
>> very difficult to have much accuracy using this method.  (easiest might be
>> to check current keysdown against previous keysdown and only log if there
>> is a difference, then use your own noggin to realize that litle is little)
>>
>>
>> On Sun, Feb 25, 2018 at 3:09 AM, Richmond Mathewson via use-livecode <
>> use-livecode at lists.runrev.com> wrote:
>>
>> Erm . . .
>>>
>>> I want to set up a stack that will list an end-user's keyDowns by sending
>>> their system
>>> a set of rawKeyUps . . .
>>>
>>> PseudoCode:
>>>
>>> in a button:
>>>
>>> on mouseUp
>>>   send "rawKeyDown" to key 113
>>> end mouseUp
>>>
>>> in the cardScript:
>>>
>>> on rawKeyDown XX
>>>    get keyUp XX
>>>    put XX somewhere useful
>>> end rawKeyDown
>>>
>>> Richmond.
>>> _______________________________________________
>>> use-livecode mailing list
>>> use-livecode at lists.runrev.com
>>> Please visit this url to subscribe, unsubscribe and manage your
>>> subscription preferences:
>>> http://lists.runrev.com/mailman/listinfo/use-livecode
>>>
>>> _______________________________________________
>> use-livecode mailing list
>> use-livecode at lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your
>> subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
>>
>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>



More information about the use-livecode mailing list