Article View: adobe.scripting.indesign
Article #21077Visible bounds of the images? AppleScript
From: Kari Puikkonen
Date: Tue, 14 May 2002 20:43
Date: Tue, 14 May 2002 20:43
13 lines
2754 bytes
2754 bytes
I have placed a lot of images in my file and cropped them.
Here is the script that should give me the size of the cropped images,
but instead I get the real, uncropped, size of the images๏ฟฝ
AppleScript set myUseVisible to true tell application "InDesign 2.0" tell document 1 tell view preferences set oldPrefs to properties set properties to {horizontal measurement units:centimeters, vertical measurement units:centimeters} end tell set oldDelims to AppleScript's text item delimiters set AppleScript's text item delimiters to {":"} repeat with i from 1 to count of links
set thePath to (file path of link i) as text set thePic to parent of link i set theHolder to parent of thePic set theParent to parent of theHolder set myBounds to visible bounds of thePic set theWidth to (item 4 of myBounds) - (item 2 of myBounds) set theHeight to (item 3 of myBounds) - (item 1 of myBounds)
-- in case it's in a group: repeat while class of theParent is not page set theParent to parent of theParent end repeat set {a, b, c, d} to visible bounds of theHolder set newFrame to make new text frame at theParent with properties {visible bounds:{a, b, a + 1, b + 100}, contents:((text item -1 of thePath) & " " & (round theWidth) & " " & (round theHeight) & " "), fill color:color "Paper", label:"Pic label"} set properties of text frame preferences of newFrame to {ignore wrap:true, inset spacing:0, first baseline offset:cap height, vertical justification:center} set properties of parent story of newFrame to {applied font:"Times", font style:"Roman", point size:10, leading:10, justification:left, left indent:0.2, hyphenation:false} set theRight to horizontal offset of character -1 of newFrame set visible bounds of newFrame to {a, b, a + 1, theRight + 0.1} end repeat set AppleScript's text item delimiters to oldDelims tell view preferences set properties to oldPrefs end tell end tell end tell
What I am doing wrong?
Technical Details
Message-ID:
<ef88799.-1@WebX.aaQKaf7vad4>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!supernews.com!peer.news.opaltelecom.net!newsfeed.icl.net!diablo.netcom.net.uk!netcom.net.uk!fr.clara.net!heighliner.fr.clara.net!newsfeed01.sul.t-online.de!t-online.de!WebXShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII X-Google-Thread: f939a,70369cde4a1b896a,start X-Google-Attributes: gidf939a,public X-Google-ArrivalTime: 2002-05-14 14:08:24 PST From: "Kari Puikkonen" <kari.puikkonen@welho.com> Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!supernews.com!peer.news.opaltelecom.net!newsfeed.icl.net!diablo.netcom.net.uk!netcom.net.uk!fr.clara.net!heighliner.fr.clara.net!newsfeed01.sul.t-online.de!t-online.de!WebX Newsgroups: adobe.scripting.indesign Subject: Visible bounds of the images? AppleScript Message-ID: <ef88799.-1@WebX.aaQKaf7vad4> Date: Tue, 14 May 2002 13:43:15 -0700 Lines: 54 MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit