Previous sections of this tutorial have shown you how to run a Praat script from the Script window. However, you can also call a Praat script from the command line (text console) instead. Information that would normally show up in the Info window, then goes to stdout, and error messages go to stderr. You cannot use commands like View & Edit.
On Unix or MacOS X, you call Praat scripts from the command line like this:
> /people/mietta/praat doit.praat 50 hallo
> /Applications/Praat.app/Contents/MacOS/Praat doit.praat 50 hallo
This opens Praat, runs the script doit.praat with arguments "50" and "hallo", and closes Praat.
You also have the possibility of running the program interactively from the command line:
> /people/mietta/praat -
You can then type in any of the fixed and dynamic commands, and commands that handle object selection, like select. This method also works in pipes:
> echo "Statistics..." | /people/mietta/praat -
On Windows, you call Praat scripts from the command line like this:
e:\praatcon.exe e:\doit.praat 50 hallo
Note that you use the program praatcon.exe instead of praat.exe. The script will write to the console output in UTF-16 Little Endian encoding. If you want to use ISO Latin-1 encoding instead, or if you want to use praatcon's output in a pipe or redirect it to a file, use praatcon -a instead.
In the above example, the script doit.praat requires two arguments. In the script doit.praat, you use form and endform to receive these arguments. See Scripting 6.1. Arguments to the script. As with the execute command, Praat will not present a form window, but simply execute the script with the arguments given on the command line. The example given in Scripting 6.1. Arguments to the script will be called in the following way:
> /people/mietta/praat playSine.praat 550 0.9
e:\praatcon.exe playSine.praat 550 0.9
© ppgb, April 7, 2013