History mechanism

The easiest way to do scripting. The history is the sequence of all menu commands (in the Objects or Picture window or in the editors), action commands (in the dynamic menu), or mouse clicks on objects (in the list of objects), that you performed during your Praat session, together with the settings that you specified in the settings windows that popped up as a result of those commands.

Viewing the history

To view your history, you first open a ScriptEditor with New Praat script or Open Praat script.... You then choose Paste history from the Edit menu.

Recording a macro

To record a sequence of mouse clicks for later re-use, perform the following steps:

1. Choose Clear history from the Edit menu. This makes the history mechanism forget all previous clicks.
2. Perform the actions that you want to record.
3. Choose Paste history from the Edit menu. Because you cleared the history before you started, the resulting script contains only the actions that you performed in step 2. You can now already re-run the actions that you performed in step 2.
4. You can save the recorded actions to a script file by choosing Save from the File menu.
5. You can put this script file under a button in the dynamic menu by choosing Add to dynamic menu... from the File menu, or under a button in a fixed menu by choosing Add to fixed menu.... This button will be preserved across Praat sessions.

This macro mechanism is much more flexible than the usual opaque macro mechanism used by most programs, because you can edit the script and make some of the arguments variable by putting them in the form clause at the top of the script. In this way, the script will prompt the user for these arguments, just as with all the menu and action commands that end in the three dots (...). See the Scripting tutorial for all the things that you can do in scripts.

Links to this page

© ppgb 20040414