execute a script by clicking

cfleck

tired
how can i make a shell script executable by clicking on it? i want to bypass having to open up the terminal to run it. thanks.
 
just make sure it opens with "Launcher"

Launcher can be found in /Applications/Utilities
 
Naming the script with .command will cause it to be opened up in Terminal.

If your shell script is called MyScript: Create a folder called MyScript.app. In it create a folder called Contents. In that create a folder called MacOS. In that, place MyScript. Make sure MyScript has execute permissions.

MyScript.app should then be a double-clickable application. Note that unless your script specifically does so, the app will not show up in the Dock.

edit: A quick search pulled up this:

http://www.maths.mq.edu.au/~steffen/tcltk/Launcher/?stylesheet=default

This would be the Launcher that wiz was talking about. Sorry, but it's not included with OS X.....yet.
 
You can execute shell scripts using applescript...

Write in ScriptEditor...

do shell script "ps -cax | grep -i Safari"
set script_result to result
display dialog "" & script_result & ""

that applescript will do an shell script "ps -cax | grep -i Safari" and then show the results in a dialog.

Hope this helps...

You can also tell Terminal to do stuff:

tell application "Terminal"
activate
do script "ps -cax | grep -i Safari"
end tell
 
is there any way i could make an apple script click executable? i tryed make it into an application the way someone said earlyer, but that didn't seem to work. Any suggestions??
 
You can save applescripts executable by saving them as application in script editor. You can also make executable applescripts with applescript studio (Apple's developer tools, Project builder + Interface builder). With applescript studio you can make some very nice looking GUIs in a matter of minutes and attach scripts to different elements of the GUI.
 
I've tryed using the Script editor and saving it as executable only, but when i go to use it, it still opens up the script editor. And how much does the applescript studio cost?
 
Applescript Studio doesn't cost anything. All you need is Apple's developer tools. You can join apple's developer connection for free at apple's site. After joining you can download the developer tools for free.

Applescript studio is just a term for using Project Builder and Interface Builder (included in developer tools) to create applescript applications.

In script editor you must choose save as... -> format: application...
 
You can also save as Run-only, but then the script won't be editable.

  • Saving as text will save your script as unmarked text that opens in Script Editor.
  • Saving as Compiled Script will open it in Script Editor, but it will retain the formatting it gained when you tested it.
  • Saving as an application will cause it to launch, then quit when it's done.
  • Saving as a stay-open application will launch it, but it won't quit when it's done.
  • Saving as a run-only compiled script is pointless because you can't open it and you can't run it.
  • Saving as a run-only application will cause your script to launch and quit when finished; you can't edit it if you make a mistake, so only do this for a final script or a script to be distributed.
  • Saving as a run-only application that stays open combines the above and 3 above.
Script Editor is free and comes with your computer; Applescript Studio is free and comes with Apple's developer tools.
 
Back
Top