Re: This Used To Work
Re: This Used To Work
- Subject: Re: This Used To Work
- From: Christopher Nebel <email@hidden>
- Date: Thu, 24 Mar 2005 10:40:32 -0800
On Mar 24, 2005, at 9:00 AM, Marconi wrote:
At 8:56 AM -0800 3/24/05, Andrew Oliver issued a series of ones and
zeros which decoded as:
On 3/24/05 8:45 AM, "Marconi" <email@hidden> wrote:
For terminal commands that require root, this used to work:
tell application "Terminal"
activate
do script "sudo requires_sudo_or_root" in front window
delay 2
do script "my_password" in front window
end tell
Why are you doing it this way instead of the normal:
do script "requires_sudo_or_root" with administrator privileges
password
"mypassword"
Didn't know this existed. Thanks, I'll try this form right away.
As you've already discovered, it sort of doesn't exist -- the proper
syntax is 'do shell script "blah" with administrator privileges".
It's part of Standard Additions, so you don't need to tell any
particular application to do it. (In fact, it's best if you tell
yourself.) You may also find <http://developer.apple.com/technotes/
tn2002/tn2065.html> useful.
Bear in mind that "do shell script" is *not* the same thing as
telling Terminal to "do script". The former forks an sh process to
execute your script (mostly) invisibly, the latter executes the
script in Terminal, whatever that happens to mean for the specified
Terminal window. Most of the time, you want "do shell script" --
it's more reliable and less intrusive. However, sometimes seeing the
script in Terminal is part of the point, so in those cases use "do
script".
--Chris Nebel
AppleScript Engineering
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden