Finally we have a reliable tool to get/set the icon of files/folders. They are two command-line binaries called “geticon” and “seticon”, part of “osxutils” (http://sourceforge.net/projects/osxutils). Easy to use and works!:
do shell script "seticon from_source to_destination"
Apparently, both source and destination can be file or folder, and also a icns file using the -d flag. “geticon” accepts various formats as output (icns, tiff, etc).
Next, you can use code like this for actually using the command in your scripts:
which brings me to my next point. When I don’t specify the complete path to the command (i.e., /usr/local/bin/seticon instead of just seticon) – and this goes for any command in the /usr/local/bin/ directory, I get the error: “sh: line 1: seticon: command not found” even though I have modified my /private/etc/profile file to look in /usr/local/bin/:
Great.
But doing this from the do shell script command:
Which is confusing because I know the “do shell script” command uses sh (really bash), not tcsh so why would it return tcsh for the $SHELL variable? According to the “do shell script” technote:
So, my final question is, jj, are you really able to run a command in your /usr/local/bin directory from a “do shell script” command without specifying the complete path? According to the technote, this should not be possible no matter how you’ve modified your shell configuration files. What do you get when you run:
You are true!
I can’t run /usr/local/bin through “do shell script” (though it does work in a Terminal session).
do shell script “echo $SHELL” returns here the “bash” shell… (same than in Terminal)