• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Keystroking a Text Field
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Keystroking a Text Field


  • Subject: Re: Keystroking a Text Field
  • From: Bill Cheeseman <email@hidden>
  • Date: Wed, 01 Jul 2015 12:01:46 -0400


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

-- 

Bill Cheeseman - email@hidden

 _______________________________________________
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

  • Follow-Ups:
    • Re: Keystroking a Text Field
      • From: Yvan KOENIG <email@hidden>
References: 
 >Keystroking a Text Field (From: Dave <email@hidden>)
 >Re: Keystroking a Text Field (From: Bill Cheeseman <email@hidden>)
 >Re: Keystroking a Text Field (From: Yvan KOENIG <email@hidden>)

  • Prev by Date: Re: AppleScript to play Beats 1?
  • Next by Date: Re: Keystroking a Text Field
  • Previous by thread: Re: Keystroking a Text Field
  • Next by thread: Re: Keystroking a Text Field
  • Index(es):
    • Date
    • Thread