On Oct 12, 2011, at 4:39 PM, Stan Cleveland wrote:
This should take care of it:
do shell script "softwareupdate -l" with administrator privileges user name"lutherf" password "blah"
The "user name" and "password" parts are optional. If not supplied, the script will prompt for the information.
if not my userIsAdmin() then
display dialog "You are not an administrative user." buttons {"Quit"} default button 1
return
end if
tell application "System Events" to set userName to name of current user
"Enter the password for the user \"" & userName & "\""
display dialog the result default answer "" buttons {"Cancel", "Enter"} default button 2 with hidden answer
set pWord to text returned of the result
do shell script "softwareupdate -l" user name userName password pWord with administrator privileges
set response to (the result as text)
on userIsAdmin()
set uid to do shell script "id -u"
set AppleScript's text item delimiters to {space}
do shell script "id -Gn " & uid
(text items of the result) as list
return "admin" is in the result
end userIsAdmin ---------------------------------------
It seems to be working in Lion, now. Thanks.