Send Keys and Window ID's?

Michael D. dweeble at wi.rr.com
Sat Dec 31 23:08:48 EST 2005


Hey Garret
Here's a bit of an answer from something I saved:

Nicolas Cueto wrote:
> Like Jacqueline, I too was going to suggest "keyDown"
> and "keyUp". However I tried it out first myself and
> found that so long as the targeted key is held conti-
> nuously down:
>
> 1. the "keyDown" message is also generated continu-
> ously. Thus, if the variable for storing the start time
> is being set by the keyDown handler, then that variable
> will be continuously reset. (To resolve this, I tried "if
> tTimeVar is not empty then" to escape the handler, but
> no luck)
>
> 2. the "keyUp" message is also being generated. I know
> this because in the keyUp handler I have a "put x in field y"
> line, which results in the field continuously blinking. (I would've
> thought the keyUp message would be generated only after
> the target key was released?)
>
> Jacqueline also suggests that these key-handlers might be
> system specific. In which case, I'm on Win2K.

It is OS-specific. On Mac OS X, keyup is only sent once when the key is
released. On Mac OS 9 a "keyup" is sent immediately after keydown, sort
of like you report.

Here is one way to possibly work around the problem (I liked Phil's
array suggestion):

local tKeyTimes

on rawkeydown k
  if tKeyTimes[k] = ""
  then put the milliseconds into tKeyTimes[k]
end rawkeydown

on rawkeyup k
  wait 50 milliseconds -- adjust this as needed
  if keysdown() contains k
  then pass rawkeyup -- they are still holding it
  get tKeyTimes[k]
  if it <> "" then
    put the milliseconds - it - 50 into tTimeVar -- holds the timing data
    put "" into tKeyTimes[k]
  end if
end rawkeyup

I didn't try it on a Windows machine though, so it may need tweaking.

-- 
Jacqueline Landman Gay         |     jacque at hyperactivesw.com
HyperActive Software           |     http://www.hyperactivesw.com
_______________________________________________
use-revolution mailing list
use-revolution at lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
----- Original Message ----- 
From: "Garrett Hylltun" <garretthylltun at gmail.com>
To: "How to use Revolution" <use-revolution at lists.runrev.com>
Sent: Saturday, December 31, 2005 2:52 PM
Subject: Send Keys and Window ID's?


> Greetings,
>
> I haven't researched the docs yet, but was just wondering if Rev/DC
> is capable of sending key strokes to non-Rev/DC windows.  If yes,
> could someone just point me to the command(s) that will get me going?
>
> Also, I'm still a newb to mac and want to know if OSX windows have
> id's and or names that I can use to send the key strokes to.
>
> Thanks in advance,
> -Garrett
>
>
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution




More information about the use-livecode mailing list