As @laaph mentioned, if you just want to run bash commands, use a bash script.
There are, however, a few issues with your commands.
Your script has to look like:
#!/bin/sh
pushd ~/Library/Vidalia
rm vidalia.conf
unzip vidalia.conf.zip
popd
open /Applications/Vidalia.app
If you didn't change to the correct directory, unzip
would unzip the file into your home directory, or wherever you launched your script from.
There are ways to look for when an app quits, but in your case this seems useless, you're removing the .conf
whenever you launch the script anyway. But if you really want that, you could simply do:
#!/bin/sh
pushd ~/Library/Vidalia
rm vidalia.conf
unzip vidalia.conf.zip
popd
open -W /Applications/Vidalia.app
pushd ~/Library/Vidalia
rm vidalia.conf
popd
(This would make the script wait until you close the app, and then it'd delete the configuration file. Again though, this is useless and redundant if you'll be only launching the app with the script.)
Also, you could try a simpler solution: I assume that what you want is just to have the same vidalia.conf whenever you start the program. If that's the case, try just making the .conf
read-only.
You can use another AppleScript that tells Finder to open files with the droplet application.
For example save this script as /Applications/droplet.app
in AppleScript Editor:
on open a
repeat with f in a
say POSIX path of f
end repeat
end open
Then run:
osascript -e 'on run {f}' -e 'tell app "Finder" to open POSIX file f as alias using POSIX file "/Applications/droplet.app"' -e end /bin/test
To open multiple files, convert the list of arguments to a list of file objects:
osascript -e 'on run a
set l to {}
repeat with f in a
set l to l & POSIX file f
end
tell app "Finder" to open l using (POSIX file "/Applications/droplet.app")
end' ~/*
Alternatively, create the droplet application with Automator instead of AppleScript Editor:
Then run open -a droplet2 /bin/test
.
The run
handler is also used for files dropped on the application. A handler named open
does not have any special meaning.
One drawback of using Automator applications is that there is a relatively long delay before they are run.
Best Answer
First step is to create an AppleScript application containing an empty file.
Next edit the applet.icns and the file to the appropriate name.
Add an app.sh file to MacOs.
Edit Info.plist to contain the following.