Experienced Praat script writers can distribute their product as a plug-in to Praat.
When Praat starts up, it will execute all Praat scripts called setup.praat that reside in directories whose name starts with plugin_ and that themselves reside in your Praat preferences directory.
Suppose that you have a set of Praat scripts specialized in the analysis and synthesis of vocalizations of guinea pigs, and that these scripts are called analyseQueak.praat and createQueak.praat ("queak" is what guinea pigs tend to say). With the ScriptEditor, you have put the script analyseQueak.praat in the dynamic menu that appears if the user selects a Sound object, and you have put the script createQueak.praat in the New menu. Only the latter script requires the user to supply some settings in a form, so the two menu commands are Analyse queak (without dots) and Create queak... (with three dots), respectively. Suppose now that you want to distribute those two commands to other guinea pig vocalization researchers.
What you do is that you create a Praat script called setup.praat (in the same directory as the two other scripts), that contains the following two lines:
Add action command... Sound 1 "" 0 "" 0 "Analyse queak" "" 0 analyseQueak.praat
Add menu command... Objects New "Create queak..." "" 0 createQueak.praat
(If you ran this script, Praat would install those two commands in the correct menus, and remember them in the buttons file; but you are now going to install them in a different way.)
You now put the three scripts in a new directory called plugin_Queak, and put this directory in your Praat preferences directory. If you are on Windows, you will now have a directory called something like C:\Documents and Settings\Your Name\Praat\plugin_Queak.
If you now start up Praat, Praat will automatically execute the script C:\Documents and Settings\Your Name\Praat\plugin_Queak\setup.praat and thereby install the two buttons. The two buttons will not be remembered in the buttons file, but they will be installed at every Praat start-up. De-installation involves removing (or renaming) the plugin_Queak directory.
To distribute the Queak plug-in among your colleague guinea pig researchers, you can use any installer program to put the plugin_Queak directory into the user's Praat preferences directory; or you could ask those colleagues to move the plugin_Queak directory there by hand.
In the example setup.praat file above, the names of the scripts analyseQueak.praat and createQueak.praat occur without any directory information. This works because Praat regards these file names as being relative to the directory where setup.praat is located. If your plug-in is much larger than two scripts, you may want to put subdirectories into the directory plugin_Queak. For instance, if you put analyseQueak.praat into the subdirectory analysis, your line in the setup.praat script would look as follows:
Add action command... Sound 1 "" 0 "" 0 "Analyse queak" "" 0 analysis/analyseQueak.praat
The forward slash ("/") in this example makes your plug-in platform-independent: it will work unchanged on Windows, Macintosh, and Unix.
Nothing prevents you from adding data files to your plug-in. For instance, your plugin_Queak directory could contain a subdirectory sounds full of guinea pig recordings, and you could make them available in the New or Open menu.
If your local guinea pig research group shares a number of Praat scripts, these can be made available to everybody in the following way:
This procedure allows all members of the group to automatically enjoy all the later changes in your custom command set.
© ppgb, January 29, 2007