🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: adobe.scripting.indesign
Article #8199

AS: get pictures with applied path name

#8199
From: Gerber_Markus
Date: Fri, 03 Nov 2006 07:29
60 lines
2662 bytes
Dear forum

I wrote a AS-script, that opens a picture with applied clipping path in photoshop and changes the clipping path to transparency, save the picture as PSD and relink it in InDesign.

It works so far, but know I want to automate this script.
I dont find the syntax to do that, so have you, forum-users a idea how I can do that?
I have to use a repeat command, but how can I get the pictures with applied clipping path from a document? I dont know the syntax for that.

The example script is made with a single picture.

system-configuration:
OS-X 10.3.9
InDesignCS2 and Photoshop CS2.

Thanks for any ideas
:-)
Markus

tell application "Adobe InDesign CS2"
	tell active document
		set myRectangle to rectangle id 112174
		set myPicture to graphic 1 of myRectangle
		tell myPicture
			set myDocReference to file path of item link as alias
			set myLink to file path of item link as string
			tell clipping path
				set myClippingPath to applied path name
			end tell

			tell application "Adobe Photoshop CS2"
				activate
				set display dialogs to never
				open myDocReference

				tell document 1
					set myPathSelection to create selection of path item myClippingPath
					set name of current layer to "Ebene 1"
					do action "Ebenenmaske" from "BPP Aktionen"
				end tell

				set myOptions to {class:Photoshop save options, embed color profile:true, save alpha channels:true, save layers:true}
				save document 1 in myDocReference as Photoshop format appending lowercase extension with options myOptions
				tell document 1 to close
				set display dialogs to always
			end tell

			set oldDelimiters to AppleScript's text item delimiters
			set AppleScript's text item delimiters to "."
			set myJPEGname to every text item of myLink
			set AppleScript's text item delimiters to oldDelimiters
			get myJPEGname as list
			set myNewJPEGname to item 1 of myJPEGname
			set myJPGname to myNewJPEGname & ".psd"

			tell item link to relink to myJPGname
			tell item link to update

		end tell
	end tell
end tell
Technical Details
Message-ID: <3bc22a91.-1@webcrossing.la2eafNXanI>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news1.google.com!news.germany.com!news.mb-net.net!open-news-network.org!news.isoc.lu!webcrossing

Show Full Headers
Complete Article Headers
X-Google-Thread: f939a,258ff0c7c47f4693,start
X-Google-Attributes: gidf939a,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: Gerber_Markus@adobeforums.com
Path: arc1-ca.pugleaf.net!g2news2.google.com!news1.google.com!news.germany.com!news.mb-net.net!open-news-network.org!news.isoc.lu!webcrossing
Newsgroups: adobe.scripting.indesign
Subject: AS: get pictures with applied path name
Message-ID: <3bc22a91.-1@webcrossing.la2eafNXanI>
Date: Thu, 2 Nov 2006 23:29:55 -0800
Lines: 67
MIME-Version: 1.0
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit