Script Editor & Command History
Files & Editors
As mentioned in the introduction, Praat scripts are plain text files that can be opened and edited in any text editor (don't use a text processor like Word or OpenOffice Writer). For advanced scripting projects with several hundreds lines of code I recommend to take advantage of sophisticated editing features like syntax coloring, code folding or auto indentation, which can be found in good editors (e.g. Notepad++ (Windows), TextWrangler (Mac), Kate (Linux), jEdit (all platforms), Sublime Text (all platforms)), but for this tutorial we'll stick with the build-in Praat script editor. It's the best choice for simple macro-like scripts (it provides exclusive access to the macro recording mechanism) and it's perfectly suitable for small scripting projects like the ones we'll work on during this tutorial.
To open the Praat script editor you have to create a new script or open an existing script. There's a menu item in the Praat main menu for both actions:
New Praat script or
Open Praat script.... (As you will see in the session on scripting environments there are more options to start the script editor.)
Save scripts regularly
Before we start adding content to the editor here is my advise on saving: Do save and do it often! It is possible to freeze Praat with a script (especially when we experiment with loops), in which case you are forced to kill Praat. If you forgot to save your script before, it's gone and you have to start from scratch! The first time you save a new script you have to give it a name (click
Save in the
File menu of the script editor). The first part of the name is up to you, for the second part, the file name suffix, I suggest to respect the convention, which is
.praat (so you might call your first script
MyFirstScript.praat). Afterwards, saving is only one keyboard shortcut away:
CTRL-s on Windows and Linux,
CMD-s on Mac.