Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Running terminal commands from the GUI UNIX
[Editor's note: See the comments for a discussion on a number of alternative methods to making this work]

I have a number of apps/scripts that I've built that can only be launched from the command line. Is there any way to either:

A) Make these double-clickable for launching

-or-

B) Create a simple app that basically executes the same commands I would type in the terminal window

For example, I have a bulletin-board client that I run locally. At present, the only way to run it is to either type the full path to it, put a link to it in a bin folder, or be in the same folder and type ./bbs . What I really want is an icon that I can double click which will open a terminal window and execute a file in a given path.
    •    
  • Currently 5.00 / 5
  You rated: 5 / 5 (3 votes cast)
 
[7,361 views]  

Running terminal commands from the GUI | 5 comments | Create New Account
Click here to return to the 'Running terminal commands from the GUI' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
try a shell script..
Authored by: Anonymous on Mar 29, '01 02:51:21AM
You could create a quick shell script that runs the bbs command for you: Edit the script with vi or whatever editor:
vi foo.sh
The contents would be something like this (the first line is critical):
#!/bin/sh
/path-to-bbs/bbs -flag1 -flag2 -flag3
Then make it executable:
chmod +x foo.sh
Changing permissions can probably be done from the Finder, but I'm more of a command line kind of guy :). You can then double click on foo.sh from the finder and select the Terminal to run it from, or cmd-option-drag it onto the Terminal icon in the Dock to run it. This isn't exactly perfect, but if you could permanently associate it to run with the Terminal, then you could double-click it and it would run every time. Anyone out there know how to make certain type of file get run with a particular program every time?

[ Reply to This | # ]
script execution from the finder
Authored by: Anonymous on Mar 29, '01 07:01:18AM

You can indeed run both scripts and command line compiled programs by command-option dragging them into the terminal program. If you want them to open in the terminal by default on double click, just use the file inspector (command-i) and go to the application pane. Now you can click on the empty square to pick an application to default to for this particular file. You can choose the terminal, but must use the pop-up menu to show all apps, not just recommended ones.

best wishes,
Toby.



[ Reply to This | # ]
script execution from the finder
Authored by: tomsinclair on Mar 29, '01 11:05:55AM

I believe that if you change the file extension to .command, you'll get an icon you can double-click and run in the Terminal.



[ Reply to This | # ]
script execution from the finder
Authored by: Anonymous on Mar 30, '01 06:26:57AM

I think I have also seen a software called "Shell scriptor" that allowed you to issue shell commands from AppleScript. I have downloaded it, but didn't find the time so far to figure out, how useful it is.
However, in order to build double-clickable shell-skripts, it should do.

Another way might be to create a Mac OS X bundle structure. (i.e. create a folder called xyz.app, with a folder Contents in it and a folder MacOS in it. I am not sure about the exact format, but it might work and you could also have custom icons, etc.



[ Reply to This | # ]
DropScript
Authored by: Anonymous on Mar 30, '01 07:38:01AM
Wilfredo Sanchez, a former Apple software engineer, created a small Cocoa app named DropScript. An idea is similar to the AppleScript or MacPerl's droplet. You can find description at Omini group's Mac OS X Dev mailing list. A pre-built application can be found here. This isn't exactly a double-click solution, but kind of neat.

[ Reply to This | # ]