• 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: Using the document element in TextEdit
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Using the document element in TextEdit


  • Subject: Re: Using the document element in TextEdit
  • From: David Durkee <email@hidden>
  • Date: Sun, 17 Jul 2005 19:49:02 -0500

Try this:

tell application "TextEdit"
    -- push the TextEdit application to the front
    activate

    -- let the user select a rtf file from disk

    set zeFile to choose file of type {"public.rtf"}

    open zeFile

    set doc to document 1

    -- get the document properties
    return properties of doc
end tell


You generally can't open a file by setting a document's path property. I'm surprised it even lets you set the path property, but my guess is that doing so only affects subsequent Save commands. To open a file in just about any scriptable app, use the open command.


David

On Jul 17, 2005, at 6:46 AM, Emile Schwarz wrote:

tell application "TextEdit"
    -- push the TextEdit application to the front
    activate

    -- get a new document
    set doc to make new document

    -- let the user select a rtf file from disk

    set zeFile to choose file of type {"public.rtf"}

    -- set to the path property the file reference
    set path of doc to zeFile

    -- get the document properties
    return properties of doc
end tell


_______________________________________________ Do not post admin requests to the list. They will be ignored. Applescript-users mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
References: 
 >Using the document element in TextEdit (From: Emile Schwarz <email@hidden>)

  • Prev by Date: Re: UI scripting: how to click 'OK' in Photo-Paint
  • Next by Date: Script application "bundles" that are read-only: error when quitting
  • Previous by thread: Using the document element in TextEdit
  • Next by thread: Re: Using the document element in TextEdit
  • Index(es):
    • Date
    • Thread