Scripting 6.2. Writing to the Info window

With the Info button and several commands in the Query menus, you write to the Info window (if your program is run from the command line, the text goes to the console window or to stdout instead; see \SS6.9).

The commands writeInfo, writeInfoLine, appendInfo and appendInfoLine allow you to write to the Info window from a script. Those with write in their name clear the Info window before they write to it, those with append in their name do not. Those with Line in their name make sure that a following appendInfo or appendInfoLine will write on the next line.

These four functions take a variable number of numeric and/or string arguments, separated by commas. The following script builds a table with statistics about a pitch contour:

writeInfoLine: " Minimum Maximum"
Create Sound as pure tone: "sine", 1, 0, 0.1, 44100, 377, 0.2, 0.01, 0.01
To Pitch: 0.01, 75, 600
minimum = Get minimum: 0, 0, "Hertz", "Parabolic"
appendInfo: minimum
appendInfo: tab$
maximum = Get maximum: 0, 0, "Hertz", "Parabolic"
appendInfo: maximum
appendInfoLine: ""

You could combine the last four print statements into:

appendInfoLine: minimum, tab$, maximum

which is the same as:

appendInfo: minimum, tab$, maximum, newline$

The little string tab$ is a tab character; it allows you to create table files that can be read by some spreadsheet programs. The little string newline$ is a newline character; it moves the following text to the next line.

To clear the Info window, you can do

writeInfo: ""

or

clearinfo

Links to this page


© ppgb, January 11, 2014