send "keyUp" / "rawKeyUp" ?

Richmond Mathewson richmondmathewson at gmail.com
Sun Feb 25 14:25:49 EST 2018


Ha, Ha: I do know how my keyboard is laid out.

I know, for instance, that if I hit the "q" key I get a raw key code of 113.

What I don't know is what "Walid" in Lahore will get when he hits the 
key on his Mac/Win/Linux keyboard
when he hits the key that yields a raw key code of 113 and is in the 
same position as the "q" key on my keyboard.

Richmond.

On 25/2/2018 8:32 pm, Mike Bonner via use-livecode wrote:
> My apologies. I assumed you knew how the keyboard was laid out on your
> mac.  For other peoples macs, you might read this page.
> https://stackoverflow.com/questions/21597804/determine-os-x-keyboard-layout-input-source-in-the-terminal-a-script
> .
> (goes off to napland)
>
> On Sun, Feb 25, 2018 at 11:06 AM, Richmond Mathewson via use-livecode <
> use-livecode at lists.runrev.com> wrote:
>
>> That's great, but I'm currently working on a Macintosh.
>>
>> Richmond.
>>
>> On 25/2/2018 7:38 pm, Mike Bonner via use-livecode wrote:
>>
>>> Just realized, if all you need to know (On linux) is the basic keyboard
>>> information, you can likely do this..
>>>
>>> put url "file:/etc/default/keyboard" into <whatevercontainer>
>>> and then parse it. Mine contains
>>> KBMODEL="pc105"
>>> KBLAYOUT="us"
>>> KBVARIANT=""
>>> KBOPTIONS=""
>>> BACKSPACE="guess"
>>>
>>> On windows, if the system has powershell (uncertain as to versions?) you
>>> might be able to get useful information
>>>
>>> set the hideconsolewindows to true
>>> set the shellcommand to "powershell"
>>> get shell("(Get-Culture).keyboardLayoutID")
>>>
>>> This will put a number into "it" in my case, 1033.
>>> Looking at this page.. https://www.science.co.il/lang
>>> uage/Locale-codes.php
>>> shows that 1033 is en_us.
>>>
>>> Alternatively, also with powershell
>>>
>>>      set the hideconsolewindows to true
>>>      set the shellcommand to "powershell"
>>>      get shell("Get--WinUserLanguageList")
>>>
>>> At which point IT contains something like..
>>> *LanguageTag     : en-US*
>>> *Autonym         : English (United States)*
>>> *EnglishName     : English*
>>> *LocalizedName   : English (United States)*
>>> *ScriptName      : Latin script*
>>> *InputMethodTips : {0409:00000409}*
>>> *Spellchecking   : True*
>>> *Handwriting     : False*
>>>
>>>
>>> The number for InputMethodTips means qwerty us, and is in the registry key
>>> (for me)
>>> The registry key: HKEY_CURRENT_USER\Keyboard Layout\Preload\1
>>> contains the same 0409 number so perhaps queryRegister could be used to
>>> grab that.
>>>
>>> If the user is using a different preferred layout (overriding normal
>>> mapping,) it might show in
>>> HKEY_CURRENT_USER\Keyboard Layout\Substitutes\1
>>> For example, looking at the number 00010409 denotes 409 english us
>>> keyboard
>>> layout overridden to be a dvorak layout.
>>>
>>> After all this, i'm thinking that having the user do a nice keyboard
>>> faceroll might still be the easiest solution.
>>>
>>> On Sun, Feb 25, 2018 at 9:26 AM, Mike Bonner <bonnmike at gmail.com> wrote:
>>>
>>> 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
>>>>>
>>>>>
>>>> _______________________________________________
>>> 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