View Single Post
NewbieStu

 
Member Since: Dec 30, 2011
Posts: 3
NewbieStu is on a distinguished road

NewbieStu is offline
I am an Applescript newbie. I wrote the following script to create a folder in MacHD>Library>Applications Support which is now write-protected in Lion (a change from Snow Leopard). It works fine, creating the folder if one of that name is not already there, skipping if folder already exists, asking for an administrator password on the way (no prob). The problem arises if the user cancels the request for the administrator password. Another request pops up, If this is canceled the script completes as if the folder had been created. How can I trap the Cancel command and cancel the whole script? Many, many thanks.

Script:

tell application "Finder"
activate
try
make new folder at folder "Application Support" of folder "Library" of startup disk with properties {name:"foldername"}
end try
display dialog "The missing folder has been successfully installed." buttons {"OK"} default button 1
end tell
QUOTE Thanks