Re: It can not be only me...
Re: It can not be only me...
- Subject: Re: It can not be only me...
- From: Paul Berkowitz <email@hidden>
- Date: Sat, 06 Dec 2003 09:56:49 -0800
On 12/6/03 9:29 AM, "Mr Tea" <email@hidden> wrote:
>
set AppleScript's text item delimiters to {"\\ "}
>
set ls to text items of posixPath
>
set AppleScript's text item delimiters to {" "}
>
set posixPath to ls as Unicode text
>
if character 1 of posixPath = "'" and character -1 of posixPath = "'" then
>
set posixPath to text 2 thru -2 of posixPath
>
set theFile to POSIX file posixPath as alias
>
end if
>
>
That should work for all types of POSIX paths, including those with no
>
spaces. But what a palaver! Shouldn't AppleScript do this for me? The entry
>
in Standard Additions doesn't seem to have any parameters or coercions for
>
dealing with file paths with spaces. Or am I missing something?
>
>
--------------------------------
>
>
Thanks for that, BTW, Paul. I found it in the archives when playing with
>
posix paths recently, and it's a very concise and useful reference.
Actually, I found it a little hard to follow my own description. ;-)
Also, I see there's and error in the mini-script above. The last line should
be _outside_ the if block, not within it. (And, I never reset TIDs. Tsk,
tsk.)
set {tids, AppleScript's text item delimiters} to {AppleScript's text
item delimiters, {"\\ "}}
set ls to text items of posixPath
set AppleScript's text item delimiters to {" "}
set posixPath to ls as Unicode text
set AppleScript's text item delimiters to tids
if character 1 of posixPath = "'" and character -1 of posixPath = "'"
then
set posixPath to text 2 thru -2 of posixPath
end if
set theFile to POSIX file posixPath as alias
--
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.