Scripting 8.2. The sendpraat program

A Windows console or Unix (MacOS, Linux) terminal program for sending messages to a running Praat program.


sendpraat [timeOut] program message...

For the meaning of the arguments, see the sendpraat subroutine.

Example 1: killing a program

sendpraat 0 praat Quit

Causes the program Praat to quit (gracefully), because Quit is a fixed command in one of its menus. On Unix, sendpraat returns immediately; on Windows, you leave out the timeOut argument.

Example 2: playing a sound file in reverse

sendpraat 1000 praat "Read from file... hello.wav" "Play reverse" "Remove"

This works because Play reverse is an action command that becomes available in the dynamic menu of the Praat program when a Sound is selected. On Unix, sendpraat will allow Praat at most 1000 seconds to perform this.

Each line is a separate argument. Lines that contain spaces should be put inside double quotes.

Example 3: drawing

sendpraat als "for i from 1 to 5" "Draw circle: 0.5, 0.5, i" "endfor"

This causes the program Als to draw five concentric circles into the Picture window.

Example 4: running a large script

sendpraat praat "runScript: \"doAll.praat\", 20"

This causes the program Praat to execute the script doAll.praat with an argument of "20".

Links to this page

© ppgb, October 20, 2015