content: (*
  Unlock Items
  David Gaxiola
  
  Droplet to recursively unlock files and folders.
  *)
  
  -- on open
  -- Process dropped files and folders.
  on open the_Droppings
  	processItems(the_Droppings)
  end open
  
  -- on run
  -- Only works as a droplet.
  on run
  	display dialog "This recursively unlocks files and folders dropped" giving up after 3
  end run
  
  -- on processItems
  -- the_Items - A list of files or folders to unlock.
  -- Iterate through and unlock files.
  -- Rescursively dive into folders and unlocks their contents.
  -- Lots of commented out debugging and progress dialogs.
  on processItems(the_Items)
  	set the_Files to {}
  	set the_Folders to {}
  	set the_NextItems to {}
  	
  	--display dialog "Processing " & the_Items & "..." giving up after 1
  	
  	repeat with an_Item in the_Items
  		--display dialog "...Processing " & an_Item & "..." giving up after 1
  		if folder of (info for an_Item) then
  			set end of the_Folders to an_Item as alias
  		else
  			set end of the_Files to an_Item as alias
  		end if
  		
  		tell application "Finder"
  			--display dialog "......Working on item " & an_Item & "." giving up after 1
  			--reveal an_Item
  			try
  				if last character of (an_Item as text) is not ":" then
  					set locked of an_Item to false
  				end if
  			on error errStr number errorNumber
  				--display dialog "Problem unlocking " & an_Item & return & "Error: " & errStr buttons {"OK"} giving up after 1
  			end try
  		end tell
  	end repeat
  	
  	--display dialog "Processing " & the_Folders & " folders..." giving up after 1
  	
  	repeat with a_Folder in the_Folders
  		try
  			--display dialog "...Processing folder " & a_Folder & "." giving up after 3
  			tell application "Finder" to set the_NextItems to get every item of folder a_Folder
  			if the_NextItems is not {} then
  				processItems(the_NextItems)
  			end if
  		on error errStr number errorNumber
  			--display dialog "Problem with processing folder " & a_Folder & return & "Error: " & errStr buttons {"OK"} giving up after 3
  		end try
  	end repeat
  end processItems
  
  
  