Mac Forums

Mac Forums (http://www.mac-forums.com/forums/)
-   OS X - Development and Darwin (http://www.mac-forums.com/forums/os-x-development-darwin/)
-   -   applescript and administrator password...help! (http://www.mac-forums.com/forums/os-x-development-darwin/262043-applescript-administrator-password-help.html)

NewbieStu 12-30-2011 07:19 PM

applescript and administrator password...help!
 
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

NewbieStu 12-31-2011 09:21 AM

Problem solved
 
I've solved this problem. Sorry to bother.


All times are GMT -4. The time now is 04:26 PM.

Powered by vBulletin
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.