• 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: Opening TextEdit with a document
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Opening TextEdit with a document


  • Subject: Re: Opening TextEdit with a document
  • From: Andrew Oliver <email@hidden>
  • Date: Sun, 15 Feb 2004 16:41:57 -0800

On 2/15/04 2:48 PM, "Craig Hoyt" <email@hidden> wrote:

> filePath is a string

And therein lies your problem. You're asking TextEdit to open a string,
which makes no sense. You need to coerce the string to a file reference.

Fortunately this is easy to do:

tell application "TextEdit"
open file filePath
end tell

Andrew
:)

> Hi All,
> I very new at this so bear with my simplistic question. I'm developing an
> application and in it I allow a TEXT document to be opened in TextEdit
> using an AppleScript. This is my Script:
>
> with timeout of 5 seconds
> tell application "TextEdit"
> activate
> open filePath
> end tell
> end timeout
>
> filePath is a string containing the complete file path surrounded by
> quotes. TextEdit is launched with a new untitled document and sent to
> frontmost app but my document file is not opened. If the TextEdit app is
> already running no document is opened and TextEdit is not sent forward. I
> suspect the problem is in my filePath var but not sure what I doing here.
> My application is a Carbon application and runs in OSX and Classic
> environments. My script for the Classic environment is much more verbose
> but opens SimpleText and my document file as I want. In OSX the above
> script fails to open the document file.
>
> Thanks for any help someone might provide in solving this issue.
> Craig
> _______________________________________________
> 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.

References: 
 >Opening TextEdit with a document (From: Craig Hoyt <email@hidden>)

  • Prev by Date: Scripting Airport Connection
  • Next by Date: Re: Scripting Airport Connection
  • Previous by thread: Opening TextEdit with a document
  • Next by thread: Scripting Airport Connection
  • Index(es):
    • Date
    • Thread