I wanted to be able, from the Terminal, to select files in the Finder. That is, to use a command like this...
showinfinder /Developer/Tools/GetFileInfo /Developer/Tools/SetFile
...and have Terminal open the Finder, with the specified file(s) selected.
Next I added this function in my alias file (I use the zsh shell). It takes care of providing the current directory:
function showinfinder() {
thepath=`pwd`;
args="";
while [ $# -ne 0 ]; do
args=`echo "$args $1"`;
shift;
done
echo "/path/to/the/script/FinderSelect.scpt" \
"Current_path:$thepath" "$args" | xargs osascript;
}
Make sure you replace /path/to/the/script/FinderSelect.scpt with the actual (full) path to your saved AppleScript. And here's an example of how it's used:
showfinder -a toto /tmp/toto2
This will add /tmp/toto2 and toto from the current directory to the current selection, and show them in the Finder. Like the script from this hint, I have the same bug and have no idea how to fix it. Any ideas?
Mac OS X Hints
http://hints.macworld.com/article.php?story=20060519105305580