• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Converting Unix path to AppleScript path
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Prev by Date: Panther versus tiger
  • Next by Date: Re: Panther versus tiger
  • Previous by thread: Re: Converting Unix path to AppleScript path
  • Next by thread: Re: Converting Unix path to AppleScript path
  • Index(es):
    • Date
    • Thread