How do I rename a bunch of Photoshop Clipping Paths?

Applescript noob here with a question that is (hopefully) simple to resolve.

This is for Photoshop CS3, Mac OS 10.5.5.

I have a server packed with thousands of Photoshop EPS images. They’ve been created over a period of several years and the clipping paths aren’t named consistently. What I need is a script that can rename every single clipping path in a given folder. I have a rudimentary routine that appears to function but doesn’t actually do anything. I assume it’s my syntax, could someone please take a look and let me know how far off the mark I am?

tell application “Adobe Photoshop CS3”
activate
set the source_folder to (choose folder with prompt “Choose folder or files for path renaming.” without invisibles)
set the item_list to list folder source_folder without invisibles
set source_folder to source_folder as string

repeat with i from 1 to number of items in the item_list
	set this_item to item i of the item_list
	set aFile to (source_folder & this_item) as alias

	try
		with timeout of 20 seconds
			open aFile showing dialogs never
			tell current document
				if exists (path item whose kind is clipping) then set path name to "Path" --I suspect this is the problem area--
			end tell
		end timeout
	end try

	save current document
	close current document saving no
end repeat

end tell

Any help would be appreciated.

Replace this line:
if exists (path item whose kind is clipping) then set path name to “Path”

With:

set thePathList to every path item
	repeat with thePath in thePathList
		if (kind of thePath is clipping) and (name of thePath is not "Path") then  --PShop will stop and prompt for a name if it already has the name
			set name of thePath to "Path"
		end if
	end repeat

Model: iMacintel
AppleScript: xCode 3.0
Browser: Safari 525.20.1
Operating System: Mac OS X (10.5)

Righteous.

That did the trick.

Many thanks.