Platypus CocoaDialog Example

It is possible to use Platypus with an ingenious open-source application called CocoaDialog to construct scripts that prompt for input and generate feedback. CocoaDialog is documented adequately at this page so I won't be covering it. Instead I will focus on how to combine it with Platypus to create powerful MacOS X applications with a user interface.

First you'll need to download CocoaDialog. You can then proceed with opening Platypus and adding it to the list of bundled files.

Below you can see a shell script that gives an example of how to query for input:



rv=`$1/Contents/Resources/$CD yesno-msgbox --string-output`
$1/Contents/Resources/$CD ok-msgbox --no-cancel --text "You pressed $rv"

This Platypus application will present the user with an Alert and several buttons. When the user presses one of the buttons, a feedback dialog is generated notifying the user which button he pressed. While this script accomplishes nothing, it serves as an example of how easy it can be to construct applications by combining Platypus with CocoaDialog.