send "keyUp" / "rawKeyUp" ?

classic Classic list List threaded Threaded
20 messages Options
Reply | Threaded
Open this post in threaded view
|

send "keyUp" / "rawKeyUp" ?

J. Landman Gay via use-livecode
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
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: send "keyUp" / "rawKeyUp" ?

J. Landman Gay via use-livecode
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 <
[hidden email]> 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
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: send "keyUp" / "rawKeyUp" ?

J. Landman Gay via use-livecode
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 <
> [hidden email]> 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
>> [hidden email]
>> Please visit this url to subscribe, unsubscribe and manage your
>> subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
>>
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: send "keyUp" / "rawKeyUp" ?

J. Landman Gay via use-livecode
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 <
[hidden email]> 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 <
>> [hidden email]> 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
>>> [hidden email]
>>> Please visit this url to subscribe, unsubscribe and manage your
>>> subscription preferences:
>>> http://lists.runrev.com/mailman/listinfo/use-livecode
>>>
>>> _______________________________________________
>> use-livecode mailing list
>> [hidden email]
>> Please visit this url to subscribe, unsubscribe and manage your
>> subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
>>
>
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: send "keyUp" / "rawKeyUp" ?

J. Landman Gay via use-livecode
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/language/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 <[hidden email]> 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 <
> [hidden email]> 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 <
>>> [hidden email]> 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
>>>> [hidden email]
>>>> Please visit this url to subscribe, unsubscribe and manage your
>>>> subscription preferences:
>>>> http://lists.runrev.com/mailman/listinfo/use-livecode
>>>>
>>>> _______________________________________________
>>> use-livecode mailing list
>>> [hidden email]
>>> Please visit this url to subscribe, unsubscribe and manage your
>>> subscription preferences:
>>> http://lists.runrev.com/mailman/listinfo/use-livecode
>>>
>>
>> _______________________________________________
>> use-livecode mailing list
>> [hidden email]
>> Please visit this url to subscribe, unsubscribe and manage your
>> subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
>>
>
>
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: send "keyUp" / "rawKeyUp" ?

J. Landman Gay via use-livecode
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/language/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 <[hidden email]> 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 <
>> [hidden email]> 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 <
>>>> [hidden email]> 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
>>>>> [hidden email]
>>>>> Please visit this url to subscribe, unsubscribe and manage your
>>>>> subscription preferences:
>>>>> http://lists.runrev.com/mailman/listinfo/use-livecode
>>>>>
>>>>> _______________________________________________
>>>> use-livecode mailing list
>>>> [hidden email]
>>>> Please visit this url to subscribe, unsubscribe and manage your
>>>> subscription preferences:
>>>> http://lists.runrev.com/mailman/listinfo/use-livecode
>>>>
>>> _______________________________________________
>>> use-livecode mailing list
>>> [hidden email]
>>> Please visit this url to subscribe, unsubscribe and manage your
>>> subscription preferences:
>>> http://lists.runrev.com/mailman/listinfo/use-livecode
>>>
>>
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: send "keyUp" / "rawKeyUp" ?

J. Landman Gay via use-livecode
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 <
[hidden email]> 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 <[hidden email]> 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 <
>>> [hidden email]> 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 <
>>>>> [hidden email]> 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
>>>>>> [hidden email]
>>>>>> Please visit this url to subscribe, unsubscribe and manage your
>>>>>> subscription preferences:
>>>>>> http://lists.runrev.com/mailman/listinfo/use-livecode
>>>>>>
>>>>>> _______________________________________________
>>>>>>
>>>>> use-livecode mailing list
>>>>> [hidden email]
>>>>> Please visit this url to subscribe, unsubscribe and manage your
>>>>> subscription preferences:
>>>>> http://lists.runrev.com/mailman/listinfo/use-livecode
>>>>>
>>>>> _______________________________________________
>>>> use-livecode mailing list
>>>> [hidden email]
>>>> Please visit this url to subscribe, unsubscribe and manage your
>>>> subscription preferences:
>>>> http://lists.runrev.com/mailman/listinfo/use-livecode
>>>>
>>>>
>>> _______________________________________________
>> use-livecode mailing list
>> [hidden email]
>> Please visit this url to subscribe, unsubscribe and manage your
>> subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
>>
>
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: send "keyUp" / "rawKeyUp" ?

J. Landman Gay via use-livecode
In reply to this post by J. Landman Gay via use-livecode
See the dictionary entry for the "type" command. This sends
rawKeyUp|rawKeyDown messages

This might let you construct a stack that "calibrates" (or whatever you
want to call it) what keys on any keyboard generate what keyDown number
and what characters


On 2/25/2018 5:09 AM, Richmond Mathewson via use-livecode 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
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: send "keyUp" / "rawKeyUp" ?

J. Landman Gay via use-livecode
In reply to this post by J. Landman Gay via use-livecode
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 <
> [hidden email]> 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 <[hidden email]> 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 <
>>>> [hidden email]> 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 <
>>>>>> [hidden email]> 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
>>>>>>> [hidden email]
>>>>>>> Please visit this url to subscribe, unsubscribe and manage your
>>>>>>> subscription preferences:
>>>>>>> http://lists.runrev.com/mailman/listinfo/use-livecode
>>>>>>>
>>>>>>> _______________________________________________
>>>>>>>
>>>>>> use-livecode mailing list
>>>>>> [hidden email]
>>>>>> Please visit this url to subscribe, unsubscribe and manage your
>>>>>> subscription preferences:
>>>>>> http://lists.runrev.com/mailman/listinfo/use-livecode
>>>>>>
>>>>>> _______________________________________________
>>>>> use-livecode mailing list
>>>>> [hidden email]
>>>>> Please visit this url to subscribe, unsubscribe and manage your
>>>>> subscription preferences:
>>>>> http://lists.runrev.com/mailman/listinfo/use-livecode
>>>>>
>>>>>
>>>> _______________________________________________
>>> use-livecode mailing list
>>> [hidden email]
>>> Please visit this url to subscribe, unsubscribe and manage your
>>> subscription preferences:
>>> http://lists.runrev.com/mailman/listinfo/use-livecode
>>>
>> _______________________________________________
>> use-livecode mailing list
>> [hidden email]
>> Please visit this url to subscribe, unsubscribe and manage your
>> subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
>>
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: send "keyUp" / "rawKeyUp" ?

J. Landman Gay via use-livecode
In reply to this post by J. Landman Gay via use-livecode
That looks like a good way to start (even though it is the wrong way round).

The next questions (now I'm on a roll, I'll keep rolling) are these:

1. How do I type a rawKey command?  I probably cannot.

2. If I have a script that runs type "q" how do I trap therawKeyDown and
the rawKeyUp codes
so I can get them into a field?

In terms of calibration all this will do is nothing as a stack that has
type "q"  is a script will
do just that regardless of the end-user's keyboard layout.

I just set my keyboard layout on my ancient iMac (10.7.5) to Bangla
(Bengali), which wouldn't know
a "q" to save its life.

My test stack still typed a "q" into my field.

I wonder what rawKeyDown and rawKeyUp the type command actually sent?

I have a fantasy that goes a bit like this:

Pseudocode

select after field "ff"
send "rawKeyUp[113]"

but LiveCode "doesn't love me" that much.

Richmond.

On 25/2/2018 8:44 pm, Paul Dupuis via use-livecode wrote:

> See the dictionary entry for the "type" command. This sends
> rawKeyUp|rawKeyDown messages
>
> This might let you construct a stack that "calibrates" (or whatever you
> want to call it) what keys on any keyboard generate what keyDown number
> and what characters
>
>
> On 2/25/2018 5:09 AM, Richmond Mathewson via use-livecode 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
>> [hidden email]
>> Please visit this url to subscribe, unsubscribe and manage your
>> subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
>>
>
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: send "keyUp" / "rawKeyUp" ?

J. Landman Gay via use-livecode
Here we go again: I reply to my own posting:

So: I have 2 fields and a button; the button having this sort of script:

on mouseUp
    put empty into fld "fff"
    select after fld "fff"
    type "q"
end mouseUp

and the cardScript of the stack having this sort of script:

on rawKeyDown RD
    put empty into fld "sss"
    put RD into fld "sss"
end rawKeyDown

at which point, on clicking on the button I get "113"
in field "sss", and, oddly enough, empty in field "fff".

Of course that doesn't help me at all as I want to do things the other
way round:

i.e. I want to send a rawKeyDown signal that fakes typing on the key on
my keyboard
that has the underlying rawKey code of 113.

Richmond.

On 25/2/2018 9:50 pm, Richmond Mathewson wrote:

> That looks like a good way to start (even though it is the wrong way
> round).
>
> The next questions (now I'm on a roll, I'll keep rolling) are these:
>
> 1. How do I type a rawKey command?  I probably cannot.
>
> 2. If I have a script that runs type "q" how do I trap therawKeyDown
> and the rawKeyUp codes
> so I can get them into a field?
>
> In terms of calibration all this will do is nothing as a stack that
> has type "q"  is a script will
> do just that regardless of the end-user's keyboard layout.
>
> I just set my keyboard layout on my ancient iMac (10.7.5) to Bangla
> (Bengali), which wouldn't know
> a "q" to save its life.
>
> My test stack still typed a "q" into my field.
>
> I wonder what rawKeyDown and rawKeyUp the type command actually sent?
>
> I have a fantasy that goes a bit like this:
>
> Pseudocode
>
> select after field "ff"
> send "rawKeyUp[113]"
>
> but LiveCode "doesn't love me" that much.
>
> Richmond.
>
> On 25/2/2018 8:44 pm, Paul Dupuis via use-livecode wrote:
>> See the dictionary entry for the "type" command. This sends
>> rawKeyUp|rawKeyDown messages
>>
>> This might let you construct a stack that "calibrates" (or whatever you
>> want to call it) what keys on any keyboard generate what keyDown number
>> and what characters
>>
>>
>> On 2/25/2018 5:09 AM, Richmond Mathewson via use-livecode 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
>>> [hidden email]
>>> Please visit this url to subscribe, unsubscribe and manage your
>>> subscription preferences:
>>> http://lists.runrev.com/mailman/listinfo/use-livecode
>>>
>> _______________________________________________
>> use-livecode mailing list
>> [hidden email]
>> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
>

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: send "keyUp" / "rawKeyUp" ?

J. Landman Gay via use-livecode
In reply to this post by J. Landman Gay via use-livecode
If you add rawkeydown handlers to your field, and then use the "type"
command to type into them, you'll trap the key code being sent (which will
always be the same for q no matter the keyboard) but there is then no
relationship to the actual key on the keyboard that I can see.

As for your 2 field experiment, if you add pass rawkeydown in your second
handler, does it solve the problem?  Catching rawkeydown without passing
it, should indeed keep anything from appearing in the field.

On Sun, Feb 25, 2018 at 12:50 PM, Richmond Mathewson via use-livecode <
[hidden email]> wrote:

> That looks like a good way to start (even though it is the wrong way
> round).
>
> The next questions (now I'm on a roll, I'll keep rolling) are these:
>
> 1. How do I type a rawKey command?  I probably cannot.
>
> 2. If I have a script that runs type "q" how do I trap therawKeyDown and
> the rawKeyUp codes
> so I can get them into a field?
>
> In terms of calibration all this will do is nothing as a stack that has
> type "q"  is a script will
> do just that regardless of the end-user's keyboard layout.
>
> I just set my keyboard layout on my ancient iMac (10.7.5) to Bangla
> (Bengali), which wouldn't know
> a "q" to save its life.
>
> My test stack still typed a "q" into my field.
>
> I wonder what rawKeyDown and rawKeyUp the type command actually sent?
>
> I have a fantasy that goes a bit like this:
>
> Pseudocode
>
> select after field "ff"
> send "rawKeyUp[113]"
>
> but LiveCode "doesn't love me" that much.
>
> Richmond.
>
> On 25/2/2018 8:44 pm, Paul Dupuis via use-livecode wrote:
>
>> See the dictionary entry for the "type" command. This sends
>> rawKeyUp|rawKeyDown messages
>>
>> This might let you construct a stack that "calibrates" (or whatever you
>> want to call it) what keys on any keyboard generate what keyDown number
>> and what characters
>>
>>
>> On 2/25/2018 5:09 AM, Richmond Mathewson via use-livecode 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
>>> [hidden email]
>>> Please visit this url to subscribe, unsubscribe and manage your
>>> subscription preferences:
>>> http://lists.runrev.com/mailman/listinfo/use-livecode
>>>
>>>
>> _______________________________________________
>> use-livecode mailing list
>> [hidden email]
>> Please visit this url to subscribe, unsubscribe and manage your
>> subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
>>
>
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: send "keyUp" / "rawKeyUp" ?

J. Landman Gay via use-livecode
11 years ago there was a discussion involving "SendKeys()"

http://use-livecode.runrev.narkive.com/9tOIimV9/simulating-keystrokes

but I can find no mention of this in the LiveCode documentation.

Richmond.

On 25/2/2018 10:02 pm, Mike Bonner via use-livecode wrote:

> If you add rawkeydown handlers to your field, and then use the "type"
> command to type into them, you'll trap the key code being sent (which will
> always be the same for q no matter the keyboard) but there is then no
> relationship to the actual key on the keyboard that I can see.
>
> As for your 2 field experiment, if you add pass rawkeydown in your second
> handler, does it solve the problem?  Catching rawkeydown without passing
> it, should indeed keep anything from appearing in the field.
>
> On Sun, Feb 25, 2018 at 12:50 PM, Richmond Mathewson via use-livecode <
> [hidden email]> wrote:
>
>> That looks like a good way to start (even though it is the wrong way
>> round).
>>
>> The next questions (now I'm on a roll, I'll keep rolling) are these:
>>
>> 1. How do I type a rawKey command?  I probably cannot.
>>
>> 2. If I have a script that runs type "q" how do I trap therawKeyDown and
>> the rawKeyUp codes
>> so I can get them into a field?
>>
>> In terms of calibration all this will do is nothing as a stack that has
>> type "q"  is a script will
>> do just that regardless of the end-user's keyboard layout.
>>
>> I just set my keyboard layout on my ancient iMac (10.7.5) to Bangla
>> (Bengali), which wouldn't know
>> a "q" to save its life.
>>
>> My test stack still typed a "q" into my field.
>>
>> I wonder what rawKeyDown and rawKeyUp the type command actually sent?
>>
>> I have a fantasy that goes a bit like this:
>>
>> Pseudocode
>>
>> select after field "ff"
>> send "rawKeyUp[113]"
>>
>> but LiveCode "doesn't love me" that much.
>>
>> Richmond.
>>
>> On 25/2/2018 8:44 pm, Paul Dupuis via use-livecode wrote:
>>
>>> See the dictionary entry for the "type" command. This sends
>>> rawKeyUp|rawKeyDown messages
>>>
>>> This might let you construct a stack that "calibrates" (or whatever you
>>> want to call it) what keys on any keyboard generate what keyDown number
>>> and what characters
>>>
>>>
>>> On 2/25/2018 5:09 AM, Richmond Mathewson via use-livecode 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
>>>> [hidden email]
>>>> Please visit this url to subscribe, unsubscribe and manage your
>>>> subscription preferences:
>>>> http://lists.runrev.com/mailman/listinfo/use-livecode
>>>>
>>>>
>>> _______________________________________________
>>> use-livecode mailing list
>>> [hidden email]
>>> Please visit this url to subscribe, unsubscribe and manage your
>>> subscription preferences:
>>> http://lists.runrev.com/mailman/listinfo/use-livecode
>>>
>> _______________________________________________
>> use-livecode mailing list
>> [hidden email]
>> Please visit this url to subscribe, unsubscribe and manage your
>> subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
>>
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: send "keyUp" / "rawKeyUp" ?

J. Landman Gay via use-livecode
In reply to this post by J. Landman Gay via use-livecode
On 2/25/18 1:57 PM, Richmond Mathewson via use-livecode wrote:
> I want to send a rawKeyDown signal that fakes typing on the key on my
> keyboard
> that has the underlying rawKey code of 113.

What does this give you on a non-US keyboard (untested):

   type numToChar(113)


--
Jacqueline Landman Gay         |     [hidden email]
HyperActive Software           |     http://www.hyperactivesw.com

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: send "keyUp" / "rawKeyUp" ?

J. Landman Gay via use-livecode
It always give a "q" as that is the Unicode name for "q".

Richmond.


On 26.02.2018 01:55, J. Landman Gay via use-livecode wrote:

> On 2/25/18 1:57 PM, Richmond Mathewson via use-livecode wrote:
>> I want to send a rawKeyDown signal that fakes typing on the key on my
>> keyboard
>> that has the underlying rawKey code of 113.
>
> What does this give you on a non-US keyboard (untested):
>
>   type numToChar(113)
>
>


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: send "keyUp" / "rawKeyUp" ?

J. Landman Gay via use-livecode
In reply to this post by J. Landman Gay via use-livecode
Do you mean:

send "rawKeyDown" WITH 113?

Bob S


> On Feb 25, 2018, at 02:09 , Richmond Mathewson via use-livecode <[hidden email]> wrote:
>
> 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
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: send "keyUp" / "rawKeyUp" ?

J. Landman Gay via use-livecode
No, I don't:

(Handler: can't find handler) near "rawKeyDown", char 1

Richmond.

On 27/2/2018 11:16 pm, Bob Sneidar via use-livecode wrote:

> Do you mean:
>
> send "rawKeyDown" WITH 113?
>
> Bob S
>
>
>> On Feb 25, 2018, at 02:09 , Richmond Mathewson via use-livecode <[hidden email]> wrote:
>>
>> 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
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: send "keyUp" / "rawKeyUp" ?

J. Landman Gay via use-livecode
In reply to this post by J. Landman Gay via use-livecode
If I understand correctly what you have in mind then you could
try the following.

Clicking the button will place one copy of numToCodepoint(M)
into both fld 1 and fld 2.
Type into the fields as usual, especially you can delete.
Typing outside the fields ("blind") will put one copy of
space&char into fld 1 and two copies of space&char into fld 2.

on mouseUp
 put 113 into M
 send "rawkeyDown M" to me
end mouseUp

In card's script:

on rawKeyDown N
  if the target contains "field "
  then pass rawKeyDown
  put numToCodepoint(N) into X
  send "keyUp X" to me
  put space & X after fld 1
end rawKeyDown

on keyUp K
  if the target contains "field "
  then pass keyUp
  put space & K after fld 2
end keyUp

> Richmond M. wrote:
> Here we go again: I reply to my own posting:
>
> So: I have 2 fields and a button; the button having this sort of script:
>
> on mouseUp
>     put empty into fld "fff"
>     select after fld "fff"
>     type "q"
> end mouseUp
>
> and the cardScript of the stack having this sort of script:
>
> on rawKeyDown RD
>     put empty into fld "sss"
>     put RD into fld "sss"
> end rawKeyDown
>
> at which point, on clicking on the button I get "113"
> in field "sss", and, oddly enough, empty in field "fff".
>
> Of course that doesn't help me at all as I want to do things the other
> way round:
>
> i.e. I want to send a rawKeyDown signal that fakes typing on the key on
> my keyboard that has the underlying rawKey code of 113.

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: send "keyUp" / "rawKeyUp" ?

J. Landman Gay via use-livecode
Well . . .

That puts "q" into both fields with a US English keyboard layout . . .

&

ит АЛСО (whoops) it ALSO puts "q" into both fields with
a Bulgarian keyboard layout.

So "NBG" I'm afraid.

Thanks for the suggestion :-)

Richmond.

P.S. Had to change 'N' to 'M'.



On 28/2/2018 11:19 am, hh via use-livecode wrote:

> If I understand correctly what you have in mind then you could
> try the following.
>
> Clicking the button will place one copy of numToCodepoint(M)
> into both fld 1 and fld 2.
> Type into the fields as usual, especially you can delete.
> Typing outside the fields ("blind") will put one copy of
> space&char into fld 1 and two copies of space&char into fld 2.
>
> on mouseUp
>   put 113 into M
>   send "rawkeyDown M" to me
> end mouseUp
>
> In card's script:
>
> on rawKeyDown N
>    if the target contains "field "
>    then pass rawKeyDown
>    put numToCodepoint(N) into X
>    send "keyUp X" to me
>    put space & X after fld 1
> end rawKeyDown
>
> on keyUp K
>    if the target contains "field "
>    then pass keyUp
>    put space & K after fld 2
> end keyUp
>
>> Richmond M. wrote:
>> Here we go again: I reply to my own posting:
>>
>> So: I have 2 fields and a button; the button having this sort of script:
>>
>> on mouseUp
>>      put empty into fld "fff"
>>      select after fld "fff"
>>      type "q"
>> end mouseUp
>>
>> and the cardScript of the stack having this sort of script:
>>
>> on rawKeyDown RD
>>      put empty into fld "sss"
>>      put RD into fld "sss"
>> end rawKeyDown
>>
>> at which point, on clicking on the button I get "113"
>> in field "sss", and, oddly enough, empty in field "fff".
>>
>> Of course that doesn't help me at all as I want to do things the other
>> way round:
>>
>> i.e. I want to send a rawKeyDown signal that fakes typing on the key on
>> my keyboard that has the underlying rawKey code of 113.
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: send "keyUp" / "rawKeyUp" ?

J. Landman Gay via use-livecode
In reply to this post by J. Landman Gay via use-livecode
Read again. Got it now. What you effectively want is the
(current) foreign keyMapping.

This is done by the OS, not gettable by LiveCode AFAIK.
Apple even doesn't has a file to check, Linux and Win have.
Look what they do:

https://wiki.archlinux.org/index.php/Keyboard_configuration_in_console
https://github.com/randyrants/sharpkeys
http://scripts.sil.org/cms/scripts/page.php?site_id=nrsi&id=ukelele

Here is what Apple did similar to that what you have in mind?
https://support.apple.com/de-de/HT201794


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode