I didn't come up with this hint, but have used it enough so as to submit it. A lot of people have created application "wrappers" for shell scripts using either dropscript or iHook. However they don't always do the job like you may wish. An alternative is to use Applescript.
For instance if you wish to run a Unix command on each file you drop on the Applescript you can do the following:
on open filelistA nice feature of OSX is that you can associate any application with a kind of file. First save your script using Script Editor as an application. Then select a file of the type you wish to associate with your script. Select "Get Info." Select the "Open with" pane and then select your Applescript application. Click the "Change All" button. Now every file of that extension will open up with your Applescript.
repeat with i in filelist
do shell script "my_command " & POSIX path of i
end repeat
end open
on open input_fileThe "do shell script" command is shown on two lines; enter it as one line with a space after the "&".
do shell script "export PATH=\"$PATH\":/sw/bin;ps2pdf \"" &
POSIX path of input_file & "\" ~/.psview.tmp.pdf; open ~/.psview.tmp.pdf"
end open
Mac OS X Hints
http://hints.macworld.com/article.php?story=20021125060127218