Detecting clipping property in a Path (Photoshop)

Hi all,

This is my first post and my first applescript also… and sorry for my english.

The objective of the applescript is dectecting whose of the whole paths in an image has the clipping property but I don’t know how to detect it on each path (only one of this can have it).

any idea? TIA!!


tell application "Adobe Photoshop CS3" --don't know if it works in leopard.
	activate
	
	set numcP to the entire path of every path item of current document
	
	display dialog "This document has " & (count numcP) & " path(s)"
	
	repeat with i from 1 to count numcP
		
		set cPname to "My Path Name " & i
		
		if exists (entire path of path item i of current document) then
			--  DON'T KNOW HOW TO MAKE WORKING THIS CONDITION!!!! AAARRGGH!!
			if (path item i whose kind is not clipping) then
				
				set dialogo to "The KIND of the path " & i & " IS NOT CLIPPING, IGNORING IT!"
				display dialog dialogo
				
			else
				
				set dialogo to "The KIND of the path " & i & " IS CLIPPING"
				display dialog dialogo
				set mypath to the entire path of path item i of current document
				set theNewPath to make new path item in current document with properties {entire path:mypath, name:cPname, kind:clipping}
				exit repeat
				
			end if
			
		end if
		
		set i to i + 1
		
	end repeat
	
end tell

Hi,
use this in document’s tell block:

set theClippingPath to every path item whose kind = clipping

and you’ll get the path item who’s clipping in the Variable “theClippingPath”. It’s only 1 entry or nothing.

Greets from
TMA

Thanks TMA

When running this applescript based on your reply I obtain an Applescript Error:

tell application "Adobe Photoshop CS3"
	activate
	
	set theClippingPath to every path item whose kind = clipping
	set cPname to "My Path Name"
	set theNewPath to make new path item in current document with properties {entire path:theClippingPath, name:cPname, kind:clipping}
	
end tell

Applescript Error
Photoshop has detected an error. Isn’t possible to obtain every path item whose kind = clipping.

morokio:

You need to talk to the Document since paths belong to the Document not the application.


tell application "Adobe Photoshop CS3"
   activate
   tell document 1
   set theClippingPath to every path item whose kind = clipping -- from TMA's suggestion
   set cPname to "My Path Name"
   set theNewPath to make new path item  with properties {entire path:theClippingPath, name:cPname, kind:clipping}
-- I took out " in current document" since you're already talking to the document directly.
   end tell
end tell

Note: This is not error trapped. It will fail if there is no document open. Also, there’s something in the syntax here that’s causing Photoshop to crash. (I just submitted a bug report to Adobe).

Have fun.
Jim Neumann
BLUEFROG

Thanks BLUEFROG, my photoshop crashes too… mmm…