Tapir Advanced Tutorial

Back to Index

This document will dwell on some of the more sophisticated ways to create Tapir menu applications.

Using scripts in your Tapir Menu App

If you know the basics of scripting, you can extend the functionality of your Tapir applications to a considerable degree, for example by parsing the output of other commands or by using external modules to load data off the Internet.

Let's first look at how to bundle a script with a Tapir app. After you're done creating the script, you press the [+] button next to the "Bundled files" list in the Tapir interface to add the newly created file:

Now, when you press the "Create" button this script will be copied over to the application generated by Tapir. The script is stored in the "Resources" folder within the bundle. All Tapir commands are executed with the "Resources" directory as the current working directory. This means that in order to execute your script as the Tapir command, you simply set it to something like this:

The output of your script will then go into the menu. It's really no more complicated than that. Remember, however, to set the shebang (#!) line, so that the shell will know what interpreter to use when it executes your script.

For a more in-depth example of using a script with a Tapir application, see the ForceQuitter tutorial.

Bundling additional resources

If your script or command depends on additional files, such as modules, images or custom configuration files, you can easily bundle them in with your script, by adding them to the Bundled Files list. They will be copied over the Resources directory, just like your script. Your script can then access them directly from the current working directory.