Article View: adobe.scripting.indesign
Article #15738Re: ID2 script not working in ID3 (aka ID CS)
From: Olav_Kvern
Date: Wed, 19 Nov 2003 20:38
Date: Wed, 19 Nov 2003 20:38
64 lines
2501 bytes
2501 bytes
alan--
Try something like this:
--MakeLabel.as
--Set the frame height to the height of the label
--(in current measurement units).
set myFrameHeight to 2
--Set myFilePath to true to include the entire file
--path in the label; set it to false to include
--only the file name.
set myFilePath to false
tell application "InDesign CS"
set mySelection to selection
if (count mySelection) > 0 then
repeat with myItem in mySelection
if class of myItem is image �
or class of myItem is EPS �
or class of myItem is PDF then
--Item was selected with the Direct selection tool;
--set myItem to the frame containing the graphic.
set myItem to parent of myItem
end if
if class of myItem is rectangle �
or class of myItem is oval �
or class of myItem is polygon then
--Changed from "count page items" in 2.x
if (count graphics of myItem) > 0 then
set myLink to item link of graphic 1 of myItem
try
if myFilePath is true then
set myLinkName to file path of myLink
else
set myLinkName to name of myLink
end if
on error
set myLinkName to "File is embedded."
end try
my myMakeLabel(myItem, myLinkName, myFrameHeight)
end if
end if
end repeat
end if
end tell
on myMakeLabel(myItem, myLinkName, myFrameHeight)
tell application "InDesign CS"
set myDate to ({the current date} as string)
set {myY2, myX1, myY1, myX2} to geometric bounds of myItem
set myY2 to myY1 + myFrameHeight
set myParent to parent of myItem
tell myParent
set myTextFrame to make text frame with properties {geometric bounds:{myY1, myX1, myY2, myX2}, contents:((myLinkName as string) & " " & myDate)}
end tell
end tell
end myMakeLabel
Thanks,
Ole
Technical Details
Message-ID:
<2cce77d0.2@webx.la2eafNXanI>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!fu-berlin.de!newsfeed01.sul.t-online.de!t-online.de!webxReferences:
<2cce77d0.-1@webx.la2eafNXanI>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII X-Google-Thread: f939a,e16117a3867bc5dc X-Google-Attributes: gidf939a,public X-Google-ArrivalTime: 2003-11-19 13:08:14 PST From: Olav_Kvern@adobeforums.com Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!fu-berlin.de!newsfeed01.sul.t-online.de!t-online.de!webx Newsgroups: adobe.scripting.indesign Subject: Re: ID2 script not working in ID3 (aka ID CS) Message-ID: <2cce77d0.2@webx.la2eafNXanI> Date: Wed, 19 Nov 2003 12:38:07 -0800 References: <2cce77d0.-1@webx.la2eafNXanI> Lines: 62 MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit