Apple script to lock folder

I’ve looked every where but couldn’t find what I am looking for.
What I’m trying to do is:

on adding folder items to theWatchedFolder after receiving these_items

-- lock the watchfolder (so that nothing can interfere my script)  

--do my script

--unlock the watchfolder

end adding folder items to

Is there away to achieve this in Applescript?

Kind regards
Marc Otten

locked is a file info property, but it can only be read, not set from plain vanilla applescript.

Assuming you have developer tools installed this will work (well it will lock/unlock the folder anyways :D)

on adding folder items to theWatchedFolder after receiving these_items
	
	do shell script "/usr/bin/SetFile -a L " & (quoted form of POSIX path of theWatchedFolder)
	
	-- do your script
	
	do shell script "/usr/bin/SetFile -a l " & (quoted form of POSIX path of theWatchedFolder)
	
end adding folder items to

Hi

Excuse me if i’m being thick and your talking about something else but can’t you lock a folder like this:

tell application "Finder" to set locked of (choose folder) to true

sorry if i’m way off here and have just stook my nose in!

Indeed you can, Pidge, even though the Finder’s dictionary says that the locked property is get only.