开发者

Writing GUI frontend for commandline application in Mac OS X

I am wondering if there is a source 开发者_StackOverflow中文版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.


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


Check out:

  • Platypus
  • iHook
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜