« 9 Types of Users: Mad Bomber | Main | 9 Types of Users: Frying Pan/Fire Tactician »
January 04, 2006
osascript vs posix paths
AppleScript vs POSIX
Q: I am having trouble with Unix path directories in my osascript...
A: Yup. Me too. I looked at your script and tried a few ideas. I did a bit of digging around and found a post at Mac Geekery and this forum post (Cube Owners) which gave me some pointers.
What appears to happen is that AppleScript is able to convert a Posix file path (slash separated) into a colon separated path (as used by the Finder) but it falls over in a screaming heap with directories.
The work around is to explicitly convert the path like this:
tell application \"Finder\"
set fileName to posix file \"some file or directory\" as file
set the label index of item fileName to 2
end tell
That will set the file label OR the directory label to 2 (Red). Tomorrow I will provide a shell script to do some auto-labelling of files.
Posted by Ozguru at January 4, 2006 06:00 AM