AppleScript can create dialogs and act on user input. For example, insert the following script and test its behavior.
-- AppleScript
-- Use a dialog to enter user defined information into an applescript.
-- There are two feedbacks possible 'text' and "choice of buttons".
-- The returned information can be used to define corresponding variables.
-- The number of buttons may not exceed three.
-- In the three examples below it is shown how to use text return, button return, and both.
activate
display dialog "Test dialog: type something below" default answer "Hello World!" buttons {"A", "B", "C"} default button "B"
set theText to (the text returned of the result)
display dialog "Test dialog: type something below" default answer "Hello World!" buttons {"A", "B", "C"} default button "B" set theButton to (the button returned of the result)
display dialog "Test dialog: type something below" default answer "Hello World!" buttons {"A", "B", "C"} default button "B" set {theText, theButton} to {the text returned of the result, the button returned of the result}
One command in this example, "activate", requires comment. When TeXShop is asked to run an AppleScript, it calls a separate program to run the script. That program, Scriptrunner, is in the TeXShop bundle. Any dialogs created by the script will be displayed by Scriptrunner rather than by TeXShop. The "activate" command brings Scriptrunner to the front so dialogs will appear on top of other windows.