You write a script that uses a global field in the Show Custom Dialog box.
Then you Set Variable to that global field. Though, you could just use the global field for whatever you're using the variable for, depending on the use.
A workaround for without creating field for dialog...
Enter Find Mode 
Show Custom Dialog [use any field for input]
Set Variable [$var ; the field]
Enter Browse Mode 
You can use "New window" positioning out of screen to hide find mode.
2 of 2 people found this helpful
Global fields are best for this. However, I sometimes "borrow" another field for this purpose. In this case, I will temporarily use the CustomerName field as a dialog input field:
Set Variable ( $temp ; CustomerName )
Set Field ( CustomerName ; "" )
Show Custom Dialog ( with the CustomerName field as the input field )
After completing the process:
Set Field ( CustomerName ; $temp )
Just be sure to return the contents of CustomerName even if the user clicks Cancel on the dialog box.