On Dec 01, 2014, at 05:53, Shane Stanley < email@hidden> wrote: No; I was using a path to a folder that didn't exist. But I still don't fancy relying on it longer-term. Especially when there's a simple alternative:
______________________________________________________________________
Hey Folks,
This works fine on Mavericks (10.9.5):
----------------------------------------------------------------------------- set theFolder to "~/Pictures/APOD ƒ/" tell application "System Events" set pathPosix to POSIX path of item theFolder set pathHFS to path of item theFolder end tell -----------------------------------------------------------------------------
The trick is that the file/folder MUST ALREADY EXIST, which is NOT how the shell operates and is therefore unintuitive (not a big deal if you know).
----------------------------------------------------------------------------- set shCMD to text 2 thru -1 of " D=~/'Pictures/AM I NUTS?/' if [ -e \"$D\" ]; then echo \"The disk item exists!\"; else echo \"The disk item does NOT exist!\"; fi " do shell script shCMD -----------------------------------------------------------------------------
I stopped using the do shell script echo <string> method a long time ago, because it was much faster to do this:
----------------------------------------------------------------------------- set path1 to "~" set path2 to "~/" set path3 to "~/Pictures/APOD ƒ/" set path1Expanded to expandTildePath(path1) set path2Expanded to expandTildePath(path2) set path3Expanded to expandTildePath(path3)
on expandTildePath(_path) if _path is "~" or _path is "~/" then set _path to POSIX path of (path to home folder as text) else if _path starts with "~/" then set _path to (POSIX path of (path to home folder as text)) & text 3 thru -1 of _path else error "Bad path string!" end if end expandTildePath -----------------------------------------------------------------------------
-- Best Regards, Chris
|