demoText.praat 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. #
  2. # First version by Xavier St-Gelais, posted to the Praat list by Thea Knowles on 2018-09-18
  3. #
  4. comment$ = ""
  5. label TEXTINPUT
  6. demo Select outer viewport: 0, 100, 0, 100
  7. demo Axes: 0, 100, 0, 100
  8. demo Erase all
  9. demo Text: 40, "centre", 80, "half",
  10. ... "Enter some text using alphanumeric characters. To erase, press BACKSPACE. To continue, press → (RIGHT ARROW)."
  11. demo Red
  12. demo Font size: 15
  13. demo Text: 40, "left", 50, "half", comment$
  14. demo Font size: 10
  15. demo Black
  16. while demoWaitForInput ( )
  17. if demoKeyPressed ( )
  18. car$ = demoKey$ ( )
  19. if car$ = "→"
  20. goto END_TEXTINPUT
  21. elsif car$ = unicode$ (8) or car$ = unicode$ (127)
  22. comment$ = left$ (comment$, length (comment$) - 1)
  23. goto REFRESH
  24. elsif car$ = unicode$ (10) or car$ = unicode$ (13)
  25. comment$ += "😀"
  26. goto REFRESH
  27. else
  28. comment$ += car$
  29. goto REFRESH
  30. endif
  31. endif
  32. endwhile
  33. label REFRESH
  34. comment$ = replace$ (comment$, newline$, "", 0)
  35. comment$ = replace$ (comment$, tab$, "", 0)
  36. goto TEXTINPUT
  37. label END_TEXTINPUT