Debian Codegraph @

docs/manual/Scripting_6_2__Writing_to_the_Info_window.html

raw
1 <html><head><meta name="robots" content="index,follow"><meta http-equiv="Content-Type" content="text/html; charset=utf-8">
2 <title>Scripting 6.2. Writing to the Info window</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 6.2. Writing to the Info window
13 </b></font></table></table>
14 <p>With the <a href="Info.html">Info</a> button and several commands in the <a href="Query_submenu.html">Query submenu</a> (or with query commands in menus in the editors), you write to the <a href="Info_window.html">Info window</a> (if your program is run from the command line, the text goes to the console window or to <i>stdout</i> instead; see <a href="Scripting_6_9__Calling_from_the_command_line.html"> S6.9).</a></p>
15 <p>The commands <a href="_writeInfo_.html"><b><code><font size=+1>writeInfo</font></code></b></a>, <a href="_writeInfoLine_.html"><b><code><font size=+1>writeInfoLine</font></code></b></a>, <a href="_appendInfo_.html"><b><code><font size=+1>appendInfo</font></code></b></a> and <a href="_appendInfoLine_.html"><b><code><font size=+1>appendInfoLine</font></code></b></a> allow you to write to the Info window from a script. Those with <b><code><font size=+1>write</font></code></b> in their name clear the Info window before they write to it, those with <b><code><font size=+1>append</font></code></b> in their name do not. Those with <b><code><font size=+1>Line</font></code></b> in their name make sure that a following <b><code><font size=+1>appendInfo</font></code></b> or <b><code><font size=+1>appendInfoLine</font></code></b> will write on the next line.</p>
16 <p>These four functions take a variable number of numeric and/or string arguments, separated by commas. Here is an example:</p>
17 <code> <a href="_writeInfoLine_.html">writeInfoLine</a>: “Pitch extrema:”<br></code>
18 <code> Create Sound as pure tone: “sine”, 1, 0, 0.1, 44100, 377, 0.2, 0.01, 0.01<br></code>
19 <code> To Pitch: 0.01, 75, 600<br></code>
20 <code> minimum = Get minimum: 0, 0, “hertz”, “parabolic”<br></code>
21 <code> <a href="_appendInfoLine_.html">appendInfoLine</a>: "Minimum: ", minimum, " Hz"<br></code>
22 <code> maximum = Get maximum: 0, 0, “hertz”, “parabolic”<br></code>
23 <code> <a href="_appendInfoLine_.html">appendInfoLine</a>: "Maximum: ", maximum, " Hz"<br></code>
24 <code style="color:red">=&gt;</code><br>
25 <code> Pitch extrema:<br></code>
26 <code> Minimum: 376.99629006909987 Hz<br></code>
27 <code> Maximum: 377.0418578707818 Hz<br></code>
28 <p>The following script builds a table with statistics about a pitch contour:</p>
29 <code> <a href="_writeInfoLine_.html">writeInfoLine</a>: “Minimum”, tab$, “Maximum”<br></code>
30 <code> <a href="_appendInfo_.html">appendInfo</a>: fixed$ (minimum, 3)<br></code>
31 <code> <a href="_appendInfo_.html">appendInfo</a>: tab$<br></code>
32 <code> <a href="_appendInfo_.html">appendInfo</a>: fixed$ (maximum, 3)<br></code>
33 <code> <a href="_appendInfoLine_.html">appendInfoLine</a>: “”<br></code>
34 <code style="color:red">=&gt;</code><br>
35 <code><table cellpadding=0 style='text-align:center;border-spacing:0'>
36 <tr><th>Minimum<th>Maximum</tr>
37 <tr><td>376.996<td>377.042</tr>
38 </table></code>
39 <p>The little string <b><code><font size=+1>tab$</font></code></b> is a <i>tab</i> character; it allows you to create table files that can be read by some spreadsheet programs. The little string <b><code><font size=+1>newline$</font></code></b> is a <i>newline</i> character; it moves the following text to the next line.</p>
40 <p>You could combine the last four print statements into:</p>
41 <code> <a href="_appendInfoLine_.html">appendInfoLine</a>: fixed$ (minimum, 3), tab$, fixed$ (maximum, 3)<br></code>
42 <code style="color:red">=&gt;</code><br>
43 <code><table cellpadding=0 style='text-align:center;border-spacing:0'>
44 <tr><th>376.996<th>377.042</tr>
45 </table></code>
46 <p>which is the same as:</p>
47 <code> <a href="_appendInfo_.html">appendInfo</a>: fixed$ (minimum, 3), tab$, fixed$ (maximum, 3), newline$<br></code>
48 <code style="color:red">=&gt;</code><br>
49 <code><table cellpadding=0 style='text-align:center;border-spacing:0'>
50 <tr><th>376.996<th>377.042</tr>
51 </table></code>
52 <p>To clear the Info window, you can do</p>
53 <code> <a href="_writeInfo_.html">writeInfo</a>: “”<br></code>
54 <p>or</p>
55 <code> <a href="_clearinfo_.html">clearinfo</a><br></code>
56 <h3>Links to this page</h3>
57 <ul>
58 <li><a href="Scripting.html">Scripting</a>
59 <li><a href="Scripting_3_1__Hello_world.html">Scripting 3.1. Hello world</a>
60 <li><a href="Scripting_6__Communication_outside_the_script.html">Scripting 6. Communication outside the script</a>
61 </ul>
62 <hr>
63 <address>
64 <p>© Paul Boersma 2022-12-02,2025</p>
65 </address>
66 </body>
67 </html>