Best way to add file unlocking to a permissions script

I have a script that changes the permissions to files droped on the app to read write for everyone. I would like to add the unlocking of files to it. using the sudo chflags -R nouchg command but not sure of the best way to add it to the script.

on open (theseFiles)
	repeat with thisFile in theseFiles
		do shell script "chmod -R 777 " & quoted form of POSIX path of theseFiles user name "MacAdmin" password "password" with administrator privileges
	end repeat
end open

Hi,

first of all: POSIX path of theseFiles doesn’t work, you must take the index variable thisFile

try this


on open theseFiles
	repeat with thisFile in theseFiles
		do shell script "chflags -R nouchg " & quoted form of POSIX path of thisFile user name "MacAdmin" password "password" with administrator privileges
		do shell script "chmod -R 777 " & quoted form of POSIX path of thisFile user name "MacAdmin" password "password" with administrator privileges
	end repeat
end open