Re: Keystroking a Text Field
Re: Keystroking a Text Field
- Subject: Re: Keystroking a Text Field
- From: Yvan KOENIG <email@hidden>
- Date: Wed, 01 Jul 2015 18:14:19 +0200
Le 01/07/2015 à 18:01, Bill Cheeseman < email@hidden> a écrit :
On Jul 1, 2015, at 11:44 AM, Yvan KOENIG < email@hidden> wrote:
Why insert a delay whose length maybe too big when we may wait just the time required by the machine ? This may be achieved with :
activate application "TextEdit"
tell application "System Events" to tell process "TextEdit" set frontmost to true keystroke "Hello Cruel World!" end tell
Fair enough, although I've never been able to tell the difference between an application with a delay of 0.1 seconds and an application with no delay.
But your script still has some redundancies. Since you're setting TextEdit's frontmost property to true in the System Events tell block, you don't need the initial activate command. And you don't need to send the 'keystroke' command to an inner TextEdit tell block. Here's my next version:
tell application "System Events" set frontmost of process "TextEdit" to true keystroke "Hello Cruel World!" end tell
Thanks. I knew that you would be able to give a better code ;-)
Yvan KOENIG (VALLAURIS, France) mercredi 1 juillet 2015 18:13:45
|
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden