I am new to apple scripting and I have a simple apple script which does below-
display dialog "Enter Your User Name:" default answer ""
set theUser to the text returned of the result
Now if the user enters nothing and clicks OK I do a check something like
if theUser = "" then
display dialog "User name is mandatory" buttons {"OK"} with title "Missing parameter" with icon "stop"
set theError to button returned of the result
if theError is "OK" then quit
end if
But it gives me a Resource wasn't found. error popup when the if condition is checked. I have tries theUser is in {"",value missing}, theUser is missing value etc. but these don’t work either. Whats wrong here?
Stop should not be in quotes. I assume that you want the script to stop executing when you send a “quit” command. You can accomplish this by adding a cancel button parameter.