Transfer icon from A to B [how-to]

Hi all!

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).

A few things about this. First, you can get a package with an installer (albeit a command line shell script installer) from the developer:

http://sveinbjorn.vefsyn.is/files/software/osxutils-1.4.tgz

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/:

# System-wide .profile for sh(1)

PATH="/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin"
export PATH

[ -r /etc/bashrc ] && source /etc/bashrc

and all of my permissions seem to be fine. Any ideas?

Thanks,
Jon


[This script was automatically tagged for color coded syntax by Convert Script to Markup Code]

This is my “~/.profile” (which may be what you need?):

##
# DELUXE-USR-LOCAL-BIN-INSERT
# (do not remove this comment)
##
echo $PATH | grep -q -s "/usr/local/bin"
if [ $? -eq 1 ] ; then
    PATH=$PATH:/usr/local/bin
    export PATH
fi
. /sw/bin/init.sh

(the last line my have be added by Fink and perhaps you don’t need it…)
And this is my “/private/etc/profile”

# System-wide .profile for sh(1)

PATH="/bin:/sbin:/usr/bin:/usr/sbin"
export PATH

[ -r /etc/bashrc ] && source /etc/bashrc

By the way, I can be wrong (absolutelly not a *nix guru), but I can use OK /usr/local/bin without specifying the full path…

I don’t have the file “~/.profile” on my machine at all, perhaps the whole file was installed by FINK (which I have not installed).

For the record, I also updated the paths to include the local path in the following files:

/private/etc/bashrc
/private/etc/csh.login
/private/etc/rc.common

but it still has not made a difference.

Jon

I added a local ~/.profile file but it still didn’t make a difference, still getting this:

Jon


[This script was automatically tagged for color coded syntax by Convert Script to Markup Code]

So I fired up the Terminal and entered:

set path = ( $path /usr/local/bin )

Then I tried:

echo $SHELL ; echo $PATH

which returns:

/bin/tcsh
/bin:/sbin:/usr/bin:/usr/sbin:/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:

Jon


[This script was automatically tagged for color coded syntax by Convert Script to Markup Code]

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)