Article View: adobe.scripting.indesign
Article #18917AS: Can't move to spread
From: Jan Suhr
Date: Mon, 03 Feb 2003 09:22
Date: Mon, 03 Feb 2003 09:22
87 lines
4653 bytes
4653 bytes
I have made a script that looks up all links and then makes a textblock with the filename of the link just under the imagebox. It works just fine for one page documents but when I try to make it work for more than one page it will not move to the other spreads.
The script picks up the Spread ID but I can't make it do anything with it.
Here is the orignial script with out spread IDs
tell application "InDesign 2.0.2"
--Ref to the document
set myDocument to active document
set myTextInfoLayerName to "Text Info"
--If the measurement units of the active document are not points, set the
--measurement units to points.
if horizontal measurement units of view preferences of myDocument is not millimeters or �
vertical measurement units of view preferences of myDocument is not millimeters then
set myOldViewPreferences to properties of view preferences of myDocument
set horizontal measurement units of view preferences of myDocument to millimeters
set vertical measurement units of view preferences of myDocument to millimeters
set myResetUnits to true
else
set myResetUnits to false
end if
tell myDocument
set Info to make paragraph style with properties �
{name:"Bildinfo", applied font:"Arial", font style:"Regular", point size:11, justification:right}
try
--Get the layer on which to place the crop marks.
set myLayer to layer myTextInfoLayerName of myDocument
on error
--Create the layer if it didn't already exist.
tell myDocument
set myLayer to make layer
set name of myLayer to myTextInfoLayerName
end tell
end try
set IDLinks to links whose status is normal
-- Checks the document for links
repeat with myCounter from 1 to (count IDLinks)
set LinkName to name of item myCounter of IDLinks as string
-- Gets the object ID and then the Links ID and then its placement
set thisLinkID to the id of item myCounter of IDLinks
set ThisImageID to the id of parent of link id thisLinkID
set ImgPos to geometric bounds of parent of parent of rectangle id thisLinkID
set myY1 to (item 1 of ImgPos)
set myX1 to (item 2 of ImgPos)
set myY2 to (item 3 of ImgPos)
set myX2 to (item 4 of ImgPos)
-- Sets the textbox size
set myX2a to (myX2 - 60)
set myY2a to (myY2 + 4)
--Creates a textbox under the lowerright corner of the imagebox
set ImgTxtFrame to make text frame
set geometric bounds of ImgTxtFrame to {myY2, myX2a, myY2a, myX2}
--Adds the links name to the textbox
set applied paragraph style of insertion point -1 of ImgTxtFrame to Info
set contents of insertion point -1 of ImgTxtFrame to (LinkName as string)
end repeat
end tell
--Resets the units
if myResetUnits is true then
tell view preferences of myDocument to set properties to myOldViewPreferences
end if
end tell
And here is the new Repeat part that I can't get to work:
repeat with myCounter from 1 to (count IDLinks)
--set LinkPath to file path of item myCounter of IDLinks as string
set LinkName to name of item myCounter of IDLinks as string
--Gets the objects ID, first on the link and then on the imageframe.
-- Ger objektets ID nummer f�rst p� l�nken sedan p� bilden.
set thisLinkID to the id of item myCounter of IDLinks
set ThisImageID to the id of parent of link id thisLinkID
-- Gets the ID of the spread
set ThisSpreadID to the id of parent of parent of parent of parent of spread id thisLinkID
--Gets the coordinates of the frame that holds the image
set ImgPos to geometric bounds of parent of parent of rectangle id thisLinkID
set myY1 to (item 1 of ImgPos)
set myX1 to (item 2 of ImgPos)
set myY2 to (item 3 of ImgPos)
set myX2 to (item 4 of ImgPos)
-- Calculates the textbox size
set myX2a to (myX2 - 60)
set myY2a to (myY2 + 4)
--set ThisSpreadID to active spread
--Creates the textbox under the lower right corner of the image box
Technical Details
Message-ID:
<1de7ab82.-1@WebX.la2eafNXanI>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-03!sn-xit-06!sn-xit-09!supernews.com!news.maxwell.syr.edu!newsfeed.online.be!newsfeed01.sul.t-online.de!t-online.de!WebXShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII X-Google-Thread: f939a,7ab2baaed378bb0f,start X-Google-Attributes: gidf939a,public X-Google-ArrivalTime: 2003-02-03 01:37:36 PST From: "Jan Suhr" <jannes@mac.com> Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-03!sn-xit-06!sn-xit-09!supernews.com!news.maxwell.syr.edu!newsfeed.online.be!newsfeed01.sul.t-online.de!t-online.de!WebX Newsgroups: adobe.scripting.indesign Subject: AS: Can't move to spread Message-ID: <1de7ab82.-1@WebX.la2eafNXanI> Date: Mon, 3 Feb 2003 01:22:37 -0800 Lines: 105 MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit