Article View: adobe.scripting.indesign
Article #17480Re: Applescript for quark syntax error
From: Olav Kvern
Date: Thu, 05 Jun 2003 21:48
Date: Thu, 05 Jun 2003 21:48
81 lines
3235 bytes
3235 bytes
alan--
Something like this (this one will work on multiple item selections):
--Set the frame height to the height of the label
--(in current measurement units).
set myFrameHeight to 12
--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 2.0.2"
set mySelection to selection
if (count mySelection) > 0 then
repeat with myItem in mySelection
if class of myItem is not text �
and class of myItem is not insertion point �
and class of myItem is not text frame �
and class of myItem is not graphic line then
if class of myItem is rectangle �
or class of myItem is oval �
or class of myItem is polygon then
if (count page items of myItem) > 0 then
if class of page item 1 of myItem is image �
or class of page item 1 of myItem is EPS �
or class of page item 1 of myItem is PDF then
set myLink to link 1 of page item 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
else if class of myItem is image �
or class of myItem is EPS �
or class of myItem is PDF then
set myLink to link of myItem
if myFilePath is true then
set myLinkName to file path of myLink
else
set myLinkName to name of myLink
end if
my myMakeLabel(myItem, myLinkName, myFrameHeight)
end if
end if
end repeat
end if
end tell
on myMakeLabel(myItem, myLinkName, myFrameHeight)
tell application "InDesign 2.0.2"
set myBounds to geometric bounds of myItem
set myX1 to item 2 of myBounds
set myX2 to item 4 of myBounds
set myY1 to item 3 of myBounds
set myY2 to myY1 + myFrameHeight
set myParent to parent of myItem
tell myParent
set myTextFrame to make text frame
move myTextFrame by {1, 1}
set geometric bounds of myTextFrame to {myY1, myX1, myY2, myX2}
set text 1 of myTextFrame to (myLinkName as string)
end tell
end tell
end myMakeLabel
Hope this works for you!
Thanks,
Ole
Technical Details
Message-ID:
<1de96c17.2@WebX.la2eafNXanI>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!sn-xit-06!sn-xit-09!supernews.com!diablo.theplanet.net!newsfeed.icl.net!newsfeed.fjserv.net!lnewspeer01.lnd.ops.eu.uu.net!emea.uu.net!newsfeed01.sul.t-online.de!t-online.de!WebXReferences:
<1de96c17.-1@WebX.la2eafNXanI>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII X-Google-Thread: f939a,536749f1a8922faf X-Google-Attributes: gidf939a,public X-Google-ArrivalTime: 2003-06-05 15:08:15 PST From: "Olav Kvern" <okvern@adobe.com> Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!sn-xit-06!sn-xit-09!supernews.com!diablo.theplanet.net!newsfeed.icl.net!newsfeed.fjserv.net!lnewspeer01.lnd.ops.eu.uu.net!emea.uu.net!newsfeed01.sul.t-online.de!t-online.de!WebX Newsgroups: adobe.scripting.indesign Subject: Re: Applescript for quark syntax error Message-ID: <1de96c17.2@WebX.la2eafNXanI> Date: Thu, 5 Jun 2003 14:48:03 -0700 References: <1de96c17.-1@WebX.la2eafNXanI> Lines: 77 MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit