You can use AppleScript Editor to create AppleScript script files or applications that do the following:
a) Launch an application
tell application "TextEdit" to activate
b) Run a shell command without opening Terminal
run shell script "/usr/local/bin/growlnotify 'Hello World'"
Applications can be dragged to the left side of the Dock. To execute normal scripts, enable AppleScript menu (which will be located in the menubar notification area) in AppleScript Editor's preferences. This menu is fed by using scripts in ~/Library/Scripts
, it displays those e.g. in ~/Library/Scripts/Applications/TextEdit
only when TextEdit in frontmost.
You can also use Automator to do this (e.g. Run Shell Script and Launch Application actions), but in my experience, it's a lot slower than running the AppleScripts themselves.
To make an executable shell script that's open the Terminal, simply chmod +x
it and save with the extension .tool
or .command
. Optionally drag to the right side of the Dock.
To launch arbitrary shell scripts from the GUI without a Terminal, simply save them as files, and create the following application (once):
Open Automator, select Application, double-click the Run Shell Script item in the library, select to receive input as arguments and enter the following:
for f in "$@"
do
source "$f"
done
(or something similar)
Now you just need to associate these shell scripts with this application (I called mine Shell Script Runner), and you can drag them to the Dock's file area.
To execute a Mac application (e.g. Firefox) with different arguments, use the following in shell:
open -a Firefox --args ProfileManager
Anything you can drag to the Dock, you can place on the desktop:
- Create an alias for Applications
- Create an alias for regular files, or just drag the files to the desktop.