Forums
New posts
Articles
Product Reviews
Policies
FAQ
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Menu
Log in
Register
Install the app
Install
Forums
macOS & iOS Developer Playground
macOS - Development and Darwin
applescript and administrator password...help!
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="NewbieStu" data-source="post: 1347747" data-attributes="member: 231062"><p>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.</p><p></p><p>Script:</p><p></p><p>tell application "Finder"</p><p> activate</p><p> try</p><p> make new folder at folder "Application Support" of folder "Library" of startup disk with properties {name:"foldername"}</p><p> end try</p><p> display dialog "The missing folder has been successfully installed." buttons {"OK"} default button 1 </p><p>end tell</p></blockquote><p></p>
[QUOTE="NewbieStu, post: 1347747, member: 231062"] 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]
Verification
Post reply
Forums
macOS & iOS Developer Playground
macOS - Development and Darwin
applescript and administrator password...help!
Top