Re: Launching TextEdit with a TEXT document
Re: Launching TextEdit with a TEXT document
- Subject: Re: Launching TextEdit with a TEXT document
- From: Paul Berkowitz <email@hidden>
- Date: Tue, 17 Feb 2004 13:08:30 -0800
On 2/16/04 7:08 PM, "Craig Hoyt" <email@hidden> wrote:
>
At 17:41:09 -0800 02/16/2004, Walter Ian Kaye
>
<email@hidden> wrote:
>
>
Well there's another way you could do it:
>
>
tell app "Finder" to open file filePath using application file id "text"
>
>
You did verify that 'filePath' contains the correct path to the file, yes?
>
>
>
TextEdit is an OSX app I wasn't aware that it had a creator type.
Typo there, but this works ("ttxt")
tell application "Finder" to get application file id "ttxt"
Since OS 10.1.3 or so, TextEdit is the default app for "TEXT", and "ttxt" is
its creator type. Back in 10.0 things were a little different. This does
work:
tell application "Finder" to open file filePath using application file
id "ttxt"
(or 'alias'). But then this works perfectly well here too (OS 10.3.2):
tell application "TextEdit" to open file filePath
>
I'll give
>
it a shot. Again I state I have no problem launching TexyEdit just opening
>
my document after it's launched. Yes I have verified that filePath is the
>
full file path and is correct.
As Shane says, there's no root folder called "Desktop Folder". If you also
have (or had) OS 9 installed there, then there's a sort of alias "Desktop
(Mac OS 9)" but it isn't a real place. You're probably looking for
(path to desktop as Unicode text)
which will turn out to be
"Macintosh Hard Disk:Users:craighoyt:Desktop:"
or something similar. It's best to check the validity of your file path by
using alias:
alias "Macintosh Hard Disk:Users:craighoyt:Desktop:My Folder:My File"
If it doesn't exist, it won't compile; if it does, it will. To save yourself
bother, this usually works best:
alias ((path to desktop as Unicode text) & "My Folder:My File")
>
>
And again Walter wrote:
>
>
Hey, wait a sec.
>
>
> filePath is a string containing the complete file path surrounded by quotes.
>
>
Surrounded by quotes???
>
>
Yes like this: "Macintosh HD:Desktop Folder:My Folder:My File". Maybe
>
surrounded by quotes was a bit cryptic, maybe I should have used some other
>
description but I'm not sure how to phrase that. The examples I saw used
>
<open file "full path names" so that's how I built the var. This same var
>
works for a slightly different script when my app is run in classic mode to
>
open SimpleText and it works perfectly.
As soon as you say 'is a string' that means it's already in quotes,
"Surrounded by quotes" gives the impression you mean something more like
this:
" " " " """"""""""" " " " " """"""""""""""""""""""""""""""""""" " " "
"""" Macintosh HD:Desktop Folder:My Folder:My File"""""
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
Now _that's_ surrounded by quotes!
--
Paul Berkowitz
_______________________________________________
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.