Re: Converting unix styled path (string) to Mac path?
Re: Converting unix styled path (string) to Mac path?
- Subject: Re: Converting unix styled path (string) to Mac path?
- From: Andrew Oliver <email@hidden>
- Date: Tue, 30 Mar 2004 16:26:54 -0800
Quite simply, you're telling the Finder to reveal a string which makes no
sense.
In addition, the cell format is in a unix-style (/-delimited) pathname, not
the Mac-style (: - delimited) pathname that the Finder expects.
The solution, fortunately, is simple. Just use the 'posix file' coercion
which will handle the conversion from a unix pathname to a Macintosh file
reference:
tell application "Finder"
activate
set openPath to cellValueText
reveal posix file openPath
end tell
Andrew
:)
On 3/30/04 4:03 PM, "Cliff Pruitt" <email@hidden> wrote:
>
Hey everyone, Maybe one of you guys can help me cause I'm ripping my
>
hair out here... ;-(
>
>
I'm new to applescript & the languages on the web that I've dealt with
>
before seem to be much better at coercion. Though in all fairness the
>
need for data types is much less in that setting. I'm trying to write
>
a really simple (I thought) script that gets a value for a cell and
>
then uses that as a path and reveals that file in the finder. If I use
>
the value from the cell (text string) it generates an error, but if I
>
try typing in the exact same path into the script itself, it runs no
>
problem.
>
>
So If anyone can explain to me how to convert a Unix Styled path as a
>
text string into a path that AppleScript can actually use I'd really
>
appreciate it a lot. I know it should be simple but I just apparently
>
lave less of an understanding than I thought I did.
>
>
heres my script:
>
>
property cellValueText : "-empty-"
>
>
tell application "OmniOutliner"
>
activate
>
set cellValueText to text of cell 2 of selected row of document 1
>
end tell
>
>
-- cellValueText is now set to:
>
-- "/Users/cpruitt/Desktop/CCBelief.rtf"
>
>
tell application "Finder"
>
activate
>
set openPath to cellValueText
>
reveal openPath
>
end tell
>
>
-- Generates Error:
>
-- Finder got an error: Can't get
>
"/Users/cpruitt/Desktop/CCBelief.rtf".
>
>
>
>
>
- Cliff
>
_______________________________________________
>
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.