Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Writing GUI frontend for commandline application in Mac OS X

I am wondering if there is a source of information on how to develop a GUI frontend application for a commandline one in Mac OS X in, but not necessarily, Xcode?

Specifically, I would love a GUI frontend that lets me specify arguments to pass to the commandline program.

Thank you very much.

like image 713
hpy Avatar asked Feb 27 '10 04:02

hpy


2 Answers

You have several options. One of the most commonly used programs to create GUI "front ends" to a script is Platypus. However, this does not allow the user to pass arguments like you want. The other option is creating a Cocoa application and using the NSTask class to run your script with arguments that the user specifies in an NSTextField or NSTokenField. In your case, I think creating a full Cocoa application written in Objective-C is overkill.

The most simple way to get what you want and still have it easy is to create a script written in AppleScript. This is a bare bones script that would do the trick:

display dialog "Enter arguments:" default answer "" buttons {"Cancel", "Run"} default button 2
set scriptArguments to text returned of result
do shell script "/path/to/script " & scriptArguments
like image 83
indragie Avatar answered Nov 09 '22 23:11

indragie


Check out:

  • Platypus
  • iHook
like image 42
Nicholas Riley Avatar answered Nov 09 '22 22:11

Nicholas Riley