Table of Contents
echo Hello world
# Hello word script in Praat echo Hello world ; write to the Info window ## NOTE: An error occurs if ";" is replaced with "#"
echo Hello world
clearinfo ; clears the Info window printline Hello world
clearinfo print Hello world'newline$'
str$ = "foo" num = 3 ### statements below causes an error. ### #Str$ = "foo" ; it begins with Upper case. #Num = 3 #str = "foo" ; it lacks $, though it has a string.
str$[1] = "foo" str$[2] = "bar" str$[3] = "hoge" str$[4] = "piyo" num[1] = 3 num[2] = 34 num[3] = 22 num[4] = 98 ### statements below causes an error. ### #str[1] = "foo" ; it lacks $, though it has a string. #Num[4] = 98 ; it begins with Upper case.
fruit$ = "apple(s)" count = 3 echo I bought 'count' 'fruit$'.
fruit$ = "apple(s)" count = 3 echo "I bought" 'count' 'fruit$' "."
str$[1]= "apple" str$[2]= "orange" str$[3]= "melon" clearinfo for i from 1 to 3 hop$ = str$[i] ;; a dummy variable printline 'i''tab$''hop$' endfor
num = 3 str$ = "hoge" clearinfo if num = 3 printline 'num' endif if str$ = "hoge" printline 'str$' endif
str1$ = "abc" str2$ = "def" str3$ = "c" str4$ = str1$ + str2$ str5$ = str1$ - str3$ clearinfo printline 'str4$' printline 'str5$'
abcdef ab
n = 10 clearinfo while n >= 1 printline 'n' n = n-1 endwhile
clearinfo max = 10 for i to max if i = 5 i = max+1 ; escape from the loop else printline 'i' endif endfor
str$ = "abcdefg" regex$ = "b[^e]*" clearinfo if index_regex(str$,regex$) <> 0 printline match else printline not match endif
str$ = "abcdefg" len = length(str$) clearinfo for i from 1 to len hop$ = mid$(str$,i,1) printline 'i''tab$''hop$' endfor
str$ = "abcdefg" substr$ = "bcd" clearinfo n = index(str$,substr$) printline 'n'
file$ = "d:\foo.txt" text$ < 'file$' clearinfo print 'text$'
file$ = "d:\bar.txt" text$ = "praat scripting is fun." + "'newline$'" text$ > 'file$' #text$ >> 'file$'