I have written a script that mounts network drives . After the mount command is issued the SMN/CIFS Filesystem Authentication box comes up. if I enter my passsword and click ok all is fine. However I want the script to realize that if the cancel button is selected the script needs to quit. How do I check to see if the cancel button was selected?
It depends on whether or not there is a result returned when a dialog button is chosen. In your script, set a variable to the result and see if there’s anything there.
-- your mount command
set foo to the result
In a traditional AppleScript generated dialog, it would go something like this:
display dialog "Yes or No?" buttons {"No", "Yes"} default button 2
set foo to the result
if button returned of foo is "Yes" then
display dialog "You chose Yes."
else
display dialog "You chose No."
end if