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 folders whose name starts with
plugin_ and that themselves reside in your Praat preferences folder.
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
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 folder 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 folder called
plugin_Queak, and put this folder in your Praat preferences folder. If you are on Windows, you will now have a folder called something like
If you now start up Praat, Praat will automatically execute the script
C:\Users\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
To distribute the Queak plug-in among your colleague guinea pig researchers, you can use any installer program to put the
plugin_Queak folder into the user’s Praat preferences folder; or you could ask those colleagues to move the
plugin_Queak folder there by hand.
In the example
setup.praat file above, the names of the scripts
createQueak.praat occur without any folder information. This works because Praat regards these file names as being relative to the folder where
setup.praat is located. If your plug-in is much larger than two scripts, you may want to put subdirectories into the folder
plugin_Queak. For instance, if you put
analyseQueak.praat into the subfolder
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 folder could contain a subfolder
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:
Uis your shared computer.
setup.praatthat contains only the following line:
setup.praatfile in a new folder called
plugin_MaldenGuineaPigResearch, and distribute this folder among your local colleagues.
This procedure allows all members of the group to automatically enjoy all the later changes in your custom command set.
© Paul Boersma 20201229, 2023