Re: duplicate command
Re: duplicate command
- Subject: Re: duplicate command
- From: "koenig.yvan" <email@hidden>
- Date: Fri, 12 Apr 2013 17:31:52 +0200
Le 12/04/2013 à 16:20, Luther Fuller < email@hidden> a écrit : On Apr 12, 2013, at 8:26 AM, koenig.yvan wrote: A password may be requested under Mountain Lion for some specific folders in which the system doesn't want changes. The root of the boot volume is one of these folders.
Thanks!
I just tested my application in Mt Lion which uses
do shell script "cp -np " & sourcePath & space & targetPath
When I tried to copy a message from Mail to the root of the boot volume, I got an error message from the code, above, ending with the phrase "Permission denied.". There was no request for a password.
A reading of the man page for 'cp' may reveal a detail on how handle a password. It may not be an improvement over 'duplicate', however.
I didn't wrote the issued message but as you saw, the access was denied.
Now, use a correct script like :
(path to desktop as text) & "get archives AppleScript - stripped.scpt" set sourcePath to quoted form of POSIX path of result "Macintosh HD:" set targetPath to quoted form of POSIX path of result
do shell script "cp -np " & sourcePath & space & targetPath with administrator privileges
You will be asked to type a password and the file will be duplicated.
As often, taking time to read the Standard Additions dictionary is useful.
do shell script v : Execute a shell script using the ‘sh’ shell do shell script text : the shell script to execute. [as type class] : the desired type of result; default is text (UTF-8) [administrator privileges boolean] : execute the command as the administrator [user name text] : use this administrator account to avoid a password dialog (If this parameter is specified, the “password” parameter must also be specified.) [password text] : use this administrator password to avoid a password dialog [altering line endings boolean] : change all line endings to Mac-style and trim a trailing one (default true) → text : the command output
Yvan KOENIG (VALLAURIS, France) vendredi 12 avril 2013 17:31:47
|
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden