need to change permissions

I need a script that changes the the permissions of any file that is dropped into a specific folder. I have a script here that will changed the permissions of a folder but not a file. Can anyone help me with this?

Thanks
Wallaper

on adding folder items to this_folder after receiving these_items
tell application “Finder”

	set j to the number of items in these_items
	set i to 1
	
	repeat until i > j
		
		--display dialog "number of items " & j & "   i = " & i
		
		
		
		set everyones privileges of (item i of these_items) to read write
		--display dialog "after everyone's"
		
		set group privileges of (item i of these_items) to read write
		--display dialog "after group's"
		
		set owner privileges of (item i of these_items) to read write
		--display dialog "after owner's"
		--display dialog " i = " & i
		
		set i to i + 1
	end repeat
end tell

end adding folder items to

try replacing this line:

on adding folder items to this_folder after receiving these_items

with this one

on adding file items to this_folder after receiving these_items
This should change permissions for files…

on adding items to this_folder after receiving these_items
This should work for files and folders.

I’m writing this from a PC so I can’t test this, but it should work.

Thanks for the reply but the line just errored out.
I think I made another script that should work for me.

on adding folder items to this_folder after receiving these_items

tell application "Terminal"
	do script "chmod -R 777 /path/to/folder"
	
	quit application "Terminal"
	
	
end tell

end adding folder items to

So using this format, how would I address this folder, if the startup disk name may not be the same on every Mac I want to run the script on?


tell application "Terminal"
	do script "chmod -R 777 /(name of startup disk)/Library/Scripts"
	quit application "Terminal"
end tell

Model: Dual 2.3GHz G5
AppleScript: 2.1.1/Script Debugger 4
Browser: Firefox 2.0.0.6
Operating System: Mac OS X (10.4)

in the shell the startup disk on every Mac is just / (a slash),
so this works regardless of the name of the startup disk and without involving the terminal


do shell script "chmod -R 777 /Library/Scripts"

I get this error in SD when trying to run the script:

Model: Dual 2.3GHz G5
AppleScript: 2.1.1/Script Debugger 4
Browser: Firefox 2.0.0.6
Operating System: Mac OS X (10.4)

the access to the main library requires authentication in most cases

do shell script "chmod -R 777 /Library/Scripts" with administrator privileges

I use this saved as a application run only, I just drop the folder I want onto it.

on open (these_objects)
	repeat with each_object in these_objects
		tell application "Finder"
			activate
			set owner privileges of each_object to read write
			set group privileges of each_object to read write
			set everyones privileges of each_object to read write
			repeat with file_object in (entire contents of each_object)repeat
				set owner privileges of file_object to read write
				set group privileges of file_object to read write
				set everyones privileges of file_object to read write
			end repeat
		end tell
	end repeat
end open

That returns:

use the do shell script version without the terminal tell block

Still getting an error:

from:

do shell script "chmod -R 777 /Library/Scripts"

Doesn’t seem like it should be difficult…

No offense, but do you read my posts? :wink:

http://bbs.applescript.net/viewtopic.php?pid=92998#p92998

StefanK,

Sorry for the confusion, I am working on network printer configs at the same time and getting a few wires crossed. :slight_smile: It makes sense now. You were right, and I was using the wrong shell script.

I am going to be running a script that includes this on more Macs and am curious if I can enter the name and password of an admin, so I do not have to go to the Mac in person. I am a bit nervous about putting the log in of an admin into a script, but I would have to do this in person otherwise.