|
In a Praat script, you can use numeric expressions as well as string expressions.
You can use a large variety of Formulas in your script:
length = 10
height = length/2
area = length * height
echo The area is 'area'.
You can use numeric variables and formulas in numeric arguments to commands:
Draw line... 0 length 0 length/2
Of course, all arguments except the last should either not contain spaces, or be enclosed in double quotes. So you would write either
Draw line... 0 height*2 0 height
or
Draw line... 0 "height * 2" 0 height
You can use numeric expressions in assignments (as above), or after if, elsif, while, until, and twice after for.
You can use a large variety of Formulas in your script:
addressee$ = "Silke"
greeting$ = "Hi " + addressee$ + "!"
echo The greeting is: 'greeting$'
You can use string variables and formulas in numeric arguments to commands:
Draw line... 0 length(greeting$) 0 100
Draw line... 0 if(answer$="yes")then(20)else(30)fi 0 100
On how to get information from commands that normally write to the Info window, see Scripting 6.3. Query commands.
© ppgb, December 7, 2008