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.
All of these have been asked before, if you had bothered to rephrase your question to be less Ubuntu-focused and look for solutions; which by the way only leads to fewer Mac users on this site being able or willing to answer. – Daniel Beck – 2011-05-06T05:36:55.483
2I did look for solutions, but I don't know the Mac-specific terms to be able to search. One cannot ask a question if one does not know what one is even asking. Also, my question is not Ubuntu-focused, it is Ubuntu-referencing. Which is my only real desktop frame of reference. (pissy response removed) – JDS – 2011-05-06T12:44:08.960
You have a point there. But are these .desktop files really nothing more than "running programs with arguments from the GUI" and "executing shell scripts by opening a file"? – Daniel Beck – 2011-05-06T12:45:52.393
The .desktop files can be as simple as "running programs with arguments from the GUI" and "executing shell scripts by opening a file", yes. They can be a little more complex, also, but not much. – JDS – 2011-05-06T12:48:28.833
Then I hope my (and the others') answers provides you with a few good ideas. Please comment on mine if you have questions. – Daniel Beck – 2011-05-06T12:49:16.400
Thanks. I removed my snippety response back after seeing your follow-up comments. IDK if you even saw it, but there you go. – JDS – 2011-05-06T12:50:39.520
@JDS Didn't, unfortunately ;-) English is my second language so I apologize for getting the term wrong. I just meant to write, if you didn't look for "Mac equivalent of [...], but "way to launch programs with arguments and run shell scripts from the GUI", you'd get better responses and the question would be useful to more other users, since the windows GUI with his .bat files and program links can learn from it, too. – Daniel Beck – 2011-05-06T13:02:11.917
Ugh. Windows guy. Not Windows GUI. – Daniel Beck – 2011-05-06T14:26:02.820