The value input by the user in response to the “ask” prompt goes into the built-in variable “it”. If you want to store that value for future use, you can assign it to another variable:
Ask "What is the first name?"
put it into firstName
Typetext firstName, tab
// do some other stuff
If not imageFound(text: firstName)
LogError "data not processed correctly"
End if
The simplest way to check if Cancel was pressed is just to test whether IT is empty:
ask "What is the first name?"
if it is empty then exit script -- or whatever action you need in this case
On the other hand, if an empty first name is a valid response, then this won’t be what you want. In that case, to distinguish between a user clicking Cancel or simply clicking OK without entering anything, you’ll have to check the result:
ask "What is the first name?"
if the result is "Cancel" then exit script -- or whatever your Cancel action is
The trick to using the result function is that you have to be sure to call it on the very next line of your script, since it reports on the status of the last command that was executed.