Re: Converting Unix path to AppleScript path
Re: Converting Unix path to AppleScript path
- Subject: Re: Converting Unix path to AppleScript path
- From: has <email@hidden>
- Date: Wed, 29 Mar 2006 17:31:24 +0100
Martin Orpen wrote:
>>Or, if you're not afraid of a bit of C, you could write a 10-line scripting addition that uses a couple of Core Foundation calls to convert the URL into a POSIX path.
>
>You don't need to go to that much trouble to use obj-c:
>[...]
Yeah, calling into Cocoa is yet another option. Here's a version that converts a URL to a POSIX path:
on urlToPOSIXPath (theURL)
-- theURL should be a valid file URL string; if URL is invalid, an error is raised
tell application "Automator"
return call method "path" of (call method "URLWithString:" of class "NSURL" with parameter theURL)
end tell
end urlToPOSIXPath
urlToPOSIXPath("file:///Volumes/Mag_Production/Color Lab Images/03:26/Issue #9 prepressed/tm.0326.chinaRS.tiff")
--> "/Volumes/Mag_Production/Color Lab Images/03:26/Issue #9 prepressed/tm.0326.chinaRS.tiff"
has
--
http://freespace.virgin.net/hamish.sanderson/
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden