Re: 1 REALLY STUPID question Cocoa support for AppleScript
Re: 1 REALLY STUPID question Cocoa support for AppleScript
- Subject: Re: 1 REALLY STUPID question Cocoa support for AppleScript
- From: Ronald Hofmann <email@hidden>
- Date: Sat, 10 Jul 2004 17:10:45 +0200
Try this:
set tFilePath to alias "Mac OS X:Users:stephane:myDocument.txt"
tell application "TextEdit"
activate
open tFilePath
end tell
Don't forget to put alias in front of the filepath. And then you don't
have to say "open file".
I think TextEdit doesn't understand "set tDocument to ". This is
something the Finder understands since it returns a doc ID.
Regards, Ronald
=============================
Am 10.07.2004 um 16:48 schrieb Stiphane Sudre:
>
What is the script you need to write in Script Editor to tell a
>
Multi-document application to open one of its document?
>
>
I tried this and it does not work obviously:
>
>
set tFilePath to "Mac OS X:Users:stephane:myDocument.txt"
>
>
tell application "TextEdit"
>
>
activate
>
>
set tDocument to open file (tFilePath)
>
>
end tell
>
>
/* Example taken from a script written for InDesign I found on the web
>
*/
>
>
The answer from Script Editor is:
>
>
'TextEdit got an error: file "Mac OS X:Users:stephane:myDocument.txt"
>
doesn't understand the open message.'
>
>
Surprisingly, I haven't found any simple sample code showing how to do
>
this in any of the article, tutorial, documentation I've read as of
>
today. This includes:
>
>
- MacDevCenter
>
>
- Apple's own AppleScript web site
>
>
- A lot of web sites dedicated to AppleScript.
>
>
All these sites explains you how to do things in the Finder, iTunes,
>
how to handle already opened documents, how to create a document,
>
etc... but NEVER how to open a document. That's crazy!
>
>
So any solution is welcome.
>
_______________________________________________
>
cocoa-dev mailing list | email@hidden
>
Help/Unsubscribe/Archives:
>
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
>
Do not post admin requests to the list. They will be ignored.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.