1

Is there a command in the Praat scripting language that will get the user's current Praat version? The reason I ask is that I want to distribute a script that uses vectors, but since vectors were only introduced in the last year, some users won't be able to run the script.

2 Answers 2

3

This line echoes the script version: echo 'praatVersion$'.

If you want to check for the current version you sound do:

versionPraat$ = left$(praatVersion$, (rindex(praatVersion$, ".")-1));
versionPraat = 'versionPraat$' #convert string to numeric

if versionPraat < 6
   exit Please download the most recent version of Praat.
endif

I stole this from a script written by Chun Chan.

1

DazedAndConfused had the basic answer: praatVersion$ gets you a string with the version. If you're looking for a way to get the major/minor/build numbers in a way that's robust to Praat's versioning convention (where 6.0, 6.0.01, and 6.1.17alpha are all valid version numbers), use the following:

dot1 = index(praatVersion$, ".")
majorVers = number(left$(praatVersion$, dot1-1))
nonMajorVers$ = right$(praatVersion$, length(praatVersion$)-dot1)
dot2 = index(nonMajorVers$, ".")
if dot2 > 0
    minorVers = number(left$(nonMajorVers$, dot2-1))
    buildVers = number(replace_regex$(right$(nonMajorVers$, length(nonMajorVers$)-dot2), "[^0-9]", "", 0))
else
    minorVers = number(replace_regex$(nonMajorVers$, "[^0-9]", "", 0))
endif

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.