But that scares me - how do I know I really cd'd there? If not, the chown -R * could be very very bad!
on open f
try
process_this(f)
end try
end open
on process_this(f)
-- set f to choose folder with prompt "Choose a folder or volume:"
set the item_info to info for f
if folder of the item_info is false then
beep
display dialog "It must be a folder, not a file!" buttons {"Oh Crap!"} default button 1
else
set f1 to quoted form of POSIX path of f
set userHome to (short user name of (system info)) as string
set f2 to userHome & "/Desktop"
if f1 contains f2 then
set my_pass to text returned of (display dialog "Enter password for " & ¬
quoted form of ¬
"Root user of this computer" with title ¬
"Fix Folder Permissions" with icon stop ¬
default answer ¬
"" buttons {"Continue…"} ¬
default button 1 ¬
with hidden answer)
try
do shell script "cd " & f1 & "; chown -R " & userHome & " " & f1 & "; chgrp -R staff " & f1 & "; chmod -R ugo=rwx " & f1 user name "root" password my_pass with administrator privileges
on error
beep
display dialog "Invalid password!" buttons {"Oh Crap!"} default button 1
end try
else
beep
display dialog "Folder must be on your desktop!" buttons {"Oh Crap!"} default button 1
end if
end if
end process_this