|
From a Praat script you can call system commands. These are the same commands that you would normally type into a terminal window or into the Window command line prompt. The syntax is the same as that of the writeInfo command.
Most system commands are different on different platforms. For instance, to throw away all WAV files in the folder whose path (relative to the script’s folder) is in the variable folder$, you would write
runSystem: "del ", folder$, "\*.wav"
on Windows, but
runSystem: "rm ", folder$, "/*.wav"
on Macintosh and Linux.
The script will stop running if a system command returns an error. For instance,
runSystem: "rm ", folder$, "/*.wav"
will stop the script if there are no WAV files in the folder. In order to prevent this, you can tell Praat to ignore the return value of the runSystem command.
Thus, to make sure that the folder contains no WAV files, you would write
runSystem_nocheck: "rm ", folder$, "/*.wav"
homeFolder$ = environment$ ("HOME")
Here is a Praat script that measures how long it takes to do a million assignments:
stopwatch
for i to 1000000
a = 1.23456789e123
endfor
time = stopwatch
writeInfoLine: a, " ", fixed$ (time, 3)
© ppgb 20201229