• 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: System Events Keystroke
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: System Events Keystroke


  • Subject: Re: System Events Keystroke
  • From: "Steven D. Majewski" <email@hidden>
  • Date: Tue, 20 Feb 2007 12:16:08 -0500


On Feb 20, 2007, at 11:34 AM, John Dulion wrote:

Hello,
I cannot get Text Edit to save. I am closing the window after my text is written and then I paste in my text to name file. I then need it to "click" the save button or the return key. Any help would be appreciated.


tell application "TextEdit" to activate
tell application "System Events"
tell process "TextEdit" to keystroke "w" using command down
delay 1
keystroke return
delay 2
tell process "TextEdit" to keystroke "v" using command down
delay 2
tell process "TextEdit" to keystroke return — this is the action that does not happen.
end tell



Thanks,


Why in the world are you using System Events GUI scripting on TextEdit
when TextEdit has a scripting dictionary that can do what you want directly
and more simply ?


tell application "TextEdit" to close document 1 saving in file "Users:..."



-- Steve Majewski



_______________________________________________
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/mailman//archives/applescript-users

This email sent to email@hidden
References: 
 >System Events Keystroke (From: John Dulion <email@hidden>)

  • Prev by Date: Re: FM 8 layout references w/applescript - works in one file, fails in five other identical files!
  • Next by Date: Re: so what's going on here?
  • Previous by thread: Re: System Events Keystroke
  • Next by thread: ical ... new fields
  • Index(es):
    • Date
    • Thread