Basic Platypus Tutorial


This short tutorial will go through the basics of creating a full-fledged Mac OS X application bundle from a script file using Platypus. When you open Platypus a window pops up that should look somewhat like this:




Open your favorite text editor, write the script you want to create an application from and save it. Then find your script in the Finder and drag it on the Platypus window (or, alternately, press the "Select.." button and locate it via navigation dialog). Now it's time to configure the application.

The controls in the Platypus window are fairly self-explanatory but I'll go through them anyway:

App Name
Here you type in the name of the application you are about to create.

Script Type
Depending on what kind of script you're creating an application from, you'll want to select the appropriate kind here. This defines the interpreter for your script (which can be defined manually in the Advanced options). When you select a script file, Platypus will automatically try to determine what kind of script it is by looking at the file suffix and shebang (#!) line.

Script Path
This is the path to the script you'll create the app from. You either define this manually by typing in the path, by pressing the "Select" button and selecting it in a navigation dialog or by dragging your script on to the Platypus window. Once you have selected a valid script, you can press the "Edit" button to open it in a text editor (which can be set in Preferences).

Output
Here you select what kind of output your application will generate. Platypus currently supports two options, either None (no output) or Progress Bar (which will display a progress bar with a "Cancel" button while your script is running).

App Icon
You can browse through template icons for your application or, alternately, drag an image or icon file for a custom icon.

Show Advanced Options
The small triangle next to "Show advanced options" will expand the Platypus window to reveal more advanced options for your application.

Create
Pressing the "Create" button will set in motion the process of creating the application. You'll be prompted for a location to create application and then, hopefully, you'll have a fully functioning Mac OS X application.



Advanced Options


Now we'll look at some of the more advanced features Platypus has to offer. Here we see the expanded part of the Platypus window once "Show advanced options" has been pressed.





Interpreter
The "Interpreter" field gives you a chance to define an interpreter of your choice. The presets cover most (if not all) of the script interpreters that come with a standard MacOS X installation, but some people may have compiled new versions in different locations.

Requires Administrator privileges
Checking "Requires Administrator privileges" will cause your application to prompt for an Administrator password and then execute the script using administrative privileges via Apple's Security Framework.

Is droppable
Enabling "Is droppable" for an app will modify the property list for for the app in question so that it can receive dropped files. These files are then passed on to the script as arguments via @ARGV. However, the first argument ($ARGV[1], $1 or whatever) to the script is always the path to the application bundle (for example "/Applications/MyPlatypusApp.app").

Files to be bundled with application into Resources folder
You can create a list of files to be copied into the Resources folder of your application bundle. These files can then be used in your script by referencing "$1/Contents/Resources/[SomeFileName]". The "+" and "-" buttons add and remove files, respectively, while "C" clears the list and "R" reveals the selected file in the Finder.



©2004 Sveinbjorn Thordarson