Re: Keystroke command limit
Re: Keystroke command limit
- Subject: Re: Keystroke command limit
- From: Paul Skinner <email@hidden>
- Date: Tue, 26 Aug 2003 12:43:25 -0400
I get consistEnt results OMM when sending 'Keystroke' forty characters
per second. If I send more than this number of characters or more
rapidly, things get complex. It looks like the keystroke buffer gets
overwritten if it's sent a new 'Keystroke' command before finishing
sending the current cue.
tell application "TextEdit"
activate
end tell
repeat 10 times
tell application "System Events"
tell process "TextEdit"
set textToSend to
"0---------0---------0---------0---------0---------0---------0---------
0---------0---------0---------0---------0---------0---------0---------
0---------0---------" as string
if length of textToSend > 40 then
repeat with i from 1 to length of textToSend by 40
try
set textToSendsubstr to text i through (i + 39) of textToSend
keystroke textToSendsubstr
delay 1
on error
set textToSendsubstr to text i through -1 of textToSend
keystroke textToSendsubstr
end try
end repeat
end if
keystroke return
end tell
end tell
end repeat
-->
0---------0---------0---------0---------0---------0---------0---------
0---------0---------0---------0---------0---------0---------0---------
0---------0---------
0---------0---------0---------0---------0---------0---------0---------
0---------0---------0---------0---------0---------0---------0---------
0---------0---------
0---------0---------0---------0---------0---------0---------0---------
0---------0---------0---------0---------0---------0---------0---------
0---------0---------
0---------0---------0---------0---------0---------0---------0---------
0---------0---------0---------0---------0---------0---------0---------
0---------0---------
0---------0---------0---------0---------0---------0---------0---------
0---------0---------0---------0---------0---------0---------0---------
0---------0---------
0---------0---------0---------0---------0---------0---------0---------
0---------0---------0---------0---------0---------0---------0---------
0---------0---------
0---------0---------0---------0---------0---------0---------0---------
0---------0---------0---------0---------0---------0---------0---------
0---------0---------
0---------0---------0---------0---------0---------0---------0---------
0---------0---------0---------0---------0---------0---------0---------
0---------0---------
0---------0---------0---------0---------0---------0---------0---------
0---------0---------0---------0---------0---------0---------0---------
0---------0---------
0---------0---------0---------0---------0---------0---------0---------
0---------0---------0---------0---------0---------0---------0---------
0---------0---------
On Tuesday, August 26, 2003, at 11:11 AM, Nigel Smith wrote:
On 26/8/03 13:02, "Marcus Rodrigues" <email@hidden> wrote:
Well, since I got no answers about this question (or the answers did
not reach me), I am darn sure the keystroke command have a limit. It
is
proven by the following super-simple script:
tell application "TextEdit"
activate
end tell
delay 5
tell application "System Events"
tell process "TextEdit"
set vaza to "1234567890 - 1234567890 - 1234567890 - 1234567890 -
1234567890 -1234567890 - 1234567890 - 1234567890 - 1234567890!!!" as
string
keystroke vaza
end tell
end tell
I *was* going to say "100 characters", because that's what I was
getting,
then JD succeeded with the whole string.
So I ran your script a few times, and counted the characters put into
TextEdit each time, getting
{"100", "100", "106", "109", "100", "100", "100", "108", "109",
"100",
"110", "100", "110"}
So the limit seems to be more a timing/processing issue than a distinct
number of characters, and will vary depending on machine, other
activity,
and so on.
Work round? Don't rely on GUI scripting for anything but the simplest
of key
presses...
Later,
Nigel
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.