Hi all
I found this script on the web and essentially it does what i need it to do but it would be a lot easier if i could convert it to a folder action script. Is there a way of doing that to this script?
on open(A)
repeat with B in A
set mypath to quoted form of POSIX path of B
if mypath is "'/'" then
error "Changing the permissions of everything on your hard disk will damage your setup. The permissions will not be changed."
else
do shell script "chmod -R 777 " & mypath
end if
end repeat
end open
This should work anyway you run it: from the Script Editor, when saved as a script and run from the Script Menu, when saved as an application and run or when items are dropped on it, or as a Folder Action:
on open these_items
repeat with this_item in these_items
set this_item to this_item as Unicode text
my process_item(this_item)
if this_item ends with ":" then my process_folder(this_item)
end repeat
end open
on run
open {choose folder with prompt "Select a folder whose permissions need modification:"}
end run
on adding folder items to this_folder after receiving these_items
open these_items
end adding folder items to
on process_folder(this_item)
tell application "System Events"
try
set these_items to files of folder this_item whose visible = true --comment out the whose clause to process invisibles too
on error
set these_items to {}
end try
try
set these_items to these_items & folders of folder this_item
end try
end tell
open these_items
end process_folder
on process_item(this_item)
do shell script "chmod -R 777 " & (quoted form of POSIX path of this_item)
end process_item