| 1 | <html><head><meta name="robots" content="index,follow"><meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
| 2 | <title>Scripting 8.2. The sendpraat program</title> |
| 3 | <style> |
| 4 | td { padding-left: 5pt; padding-right: 5pt; } |
| 5 | th { padding-left: 5pt; padding-right: 5pt; } |
| 6 | code { white-space: pre-wrap; } |
| 7 | dd { white-space: pre-wrap; } |
| 8 | </style> |
| 9 | </head><body bgcolor="#FFFFFF"> |
| 10 | |
| 11 | <table border=0 cellpadding=0 cellspacing=0><tr><td bgcolor="#CCCC00"><table border=4 cellpadding=9><tr><td align=middle bgcolor="#000000"><font face="Palatino,Times" size=6 color="#999900"><b> |
| 12 | Scripting 8.2. The sendpraat program |
| 13 | </b></font></table></table> |
| 14 | <p>Sendpraat can be a Windows console or Unix (MacOS, Linux) terminal program for sending messages to a <i>running</i> Praat program.</p> |
| 15 | <h2>Command line syntax</h2> |
| 16 | <code> <b>sendpraat7</b> [<i>timeOut</i>] [--FULL-TRUST] <i>program</i> <i>message</i> ...<br></code> |
| 17 | <p>For the meaning of the arguments, see <a href="Scripting_8_1__The_sendpraat_subroutine.html">the sendpraat subroutine</a>.</p> |
| 18 | <h2>Example 1: killing a program</h2> |
| 19 | <code> <b>sendpraat7</b> 0 praat Quit<br></code> |
| 20 | <p>Causes the program <b>Praat</b> to quit (gracefully), because <b>Quit</b> is a fixed command in one of its menus. On Unix, <code><font size=+1>sendpraat</font></code> returns immediately; on Windows, you leave out the <i><code><font size=+1>timeOut</font></code></i> argument.</p> |
| 21 | <h2>Example 2: playing a sound file in reverse</h2> |
| 22 | <code> <b>sendpraat7</b> 1000 praat "Read from file... hello.wav" "Play reverse" "Remove"<br></code> |
| 23 | <p>This works because <b>Play reverse</b> is an action command that becomes available in the dynamic menu of the <b>Praat</b> program when a Sound is selected. On Unix, <code><font size=+1>sendpraat</font></code> will allow <b>Praat</b> at most 1000 seconds to perform this.</p> |
| 24 | <p>Each line is a separate argument. Lines that contain spaces should be put inside double quotes.</p> |
| 25 | <h2>Example 3: drawing</h2> |
| 26 | <code> <b>sendpraat7</b> als "for i from 1 to 5" "Draw circle: 0.5, 0.5, i" "endfor"<br></code> |
| 27 | <p>This causes the program <b>Als</b> to draw five concentric circles into the Picture window.</p> |
| 28 | <p>Example 4: running a large script</p> |
| 29 | <code> <b>sendpraat7</b> praat "runScript: \"doAll.praat\", 20"<br></code> |
| 30 | <p>This causes the program <b>Praat</b> to execute the script <b>doAll.praat</b> with an argument of "20".</p> |
| 31 | <h2>How to download</h2> |
| 32 | <p>You can download the sendpraat program via <code><font size=+1>https://praat.org/sendpraat.html</font></code> or from <code><font size=+1>https://www.fon.hum.uva.nl/praat/sendpraat.html</font></code>.</p> |
| 33 | <h3>Links to this page</h3> |
| 34 | <ul> |
| 35 | <li><a href="Scripting.html">Scripting</a> |
| 36 | <li><a href="Scripting_8__Controlling_Praat_from_another_program.html">Scripting 8. Controlling Praat from another program</a> |
| 37 | </ul> |
| 38 | <hr> |
| 39 | <address> |
| 40 | <p>© Paul Boersma #1997,2000,2003,2005,2014,2015,2021,2023,2026</p> |
| 41 | </address> |
| 42 | </body> |
| 43 | </html> |