label: dialog
Comment: initialize variables
Set Variable RESULT to 
Set Variable PORT to 
 
Comment: display the dialog
Display Dialog: main, wait for dialog to return (modal)
 
Comment: make sure PORT (the variable from the dialog input) is a number
PORT = $PORT$ + 0
 
Comment: if adding 0 to the port results in an empty string, the input was not a valid number
if Variable PORT Equals 
  MessageBox: Input Error, Please enter a number.
  GoTo Label: dialog
end
 
Comment: check that the number is between 0-65535
Evaluate Expression ($PORT$ > "65535" or $PORT$ <  "0") into variable RESULT
if Variable RESULT Equals TRUE
  MessageBox: Input Error, Please enter a number between 0-65535.
  GoTo Label: dialog
end
 
MessageBox: OK, Port $PORT$ is valid!
Terminate Installation
