🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: adobe.scripting.indesign
Article #19434

Re: Yearbook Layout - Image Question

#19434
From: Dave Saunders
Date: Thu, 19 Dec 2002 17:34
31 lines
2527 bytes
For the record, the script I posted is flawed. I was making assumptions about how scaling works that aren't true. The scaling is applied (when using the set scale command I used) relative to the current proxy point. Since I was running it with the proxy point at center, that fooled me into thinking that my script had run successfully when it fact it hadn't. I still don't fully understand the error I got, but never mind that.

Here's a correct version of the script using the scale command:



-- This script scales the selected image to fit its frame.

tell application "InDesign 2.0.2" 
 set myImage to page item 1 of item 1 of selection 
 set visible bounds of myImage to (visible bounds of parent of myImage) 
 set myHoriz to horizontal scale of myImage 
 set myVert to vertical scale of myImage 
 if myVert > myHoriz then 
  scale myImage around center anchor vertical scale myHoriz horizontal scale myHoriz with considering current scale 
 else 
  scale myImage around center anchor horizontal scale myVert vertical scale myVert with considering current scale 
 end if 
end tell



I also tried to use the fit command to achieve the same effect:

tell application "InDesign 2.0.2"
 fit (item 1 of selection) given proportionally
end tell

But this mysteriously doesn't work. It uses the scaling of the existing frame to determine the meaning of "proportionally" which is not what is wanted (of course, if the scaling of the frame was the same in both directions, that woud be OK, but in my test it wasn't). And, it moves the image to the top of the frame, not the center.

Dave
Technical Details
Message-ID: <1de709e3.4@WebX.la2eafNXanI>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-03!sn-xit-01!sn-xit-09!supernews.com!newshosting.com!news-xfer1.atl.newshosting.com!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed.icl.net!newsfeed.fjserv.net!colt.net!diablo.netcom.net.uk!netcom.net.uk!fr.clara.net!heighliner.fr.clara.net!newsfeed01.sul.t-online.de!t-online.de!WebX
References: <1de709e3.-1@WebX.la2eafNXanI> <1de709e3.0@WebX.la2eafNXanI>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f939a,7902a6737449c5aa
X-Google-Attributes: gidf939a,public
X-Google-ArrivalTime: 2002-12-19 09:37:48 PST
From: "Dave Saunders" <daves@pdsassoc.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-03!sn-xit-01!sn-xit-09!supernews.com!newshosting.com!news-xfer1.atl.newshosting.com!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed.icl.net!newsfeed.fjserv.net!colt.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: Re: Yearbook Layout - Image Question
Message-ID: <1de709e3.4@WebX.la2eafNXanI>
Date: Thu, 19 Dec 2002 09:34:44 -0800
References: <1de709e3.-1@WebX.la2eafNXanI> <1de709e3.0@WebX.la2eafNXanI>
Lines: 38
MIME-Version: 1.0
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit