🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: adobe.scripting.indesign
Article #19401

Re: Yearbook Layout - Image Question

#19401
From: Dave Saunders
Date: Tue, 17 Dec 2002 16:50
27 lines
1932 bytes
You can access a fit command from a script.

You can also say:

set visible bounds of myImage to (visible bounds of parent of myImage)

However, this will distort the image. If you want to preserve the proportions, then this will do it:

-- 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
  set vertical scale of myImage to myHoriz
  move myImage by {0, ((item 3 of visible bounds of myImage) - (item 3 of visible bounds of parent of myImage)) * 0.5}
 else
  set horizontal scale of myImage to myVert
  move myImage by {((item 4 of visible bounds of myImage) - (item 4 of visible bounds of parent of myImage)) * 0.5, 0}
 end if
end tell

Oddly, though, when I run this script, even though it seems to work properly, I get an error message to the effect that some part of the move instruction (whichever one is used) failed to return a result.

Dave
Technical Details
Message-ID: <1de709e3.0@WebX.la2eafNXanI>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news1.google.com!sn-xit-02!sn-xit-01!sn-xit-08!supernews.com!newsfeed.news2me.com!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed.esat.net!newsfeed.online.be!newsfeed01.sul.t-online.de!t-online.de!WebX
References: <1de709e3.-1@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-17 09:08:26 PST
From: "Dave Saunders" <daves@pdsassoc.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news1.google.com!sn-xit-02!sn-xit-01!sn-xit-08!supernews.com!newsfeed.news2me.com!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed.esat.net!newsfeed.online.be!newsfeed01.sul.t-online.de!t-online.de!WebX
Newsgroups: adobe.scripting.indesign
Subject: Re: Yearbook Layout - Image Question
Message-ID: <1de709e3.0@WebX.la2eafNXanI>
Date: Tue, 17 Dec 2002 08:50:35 -0800
References: <1de709e3.-1@WebX.la2eafNXanI>
Lines: 32
MIME-Version: 1.0
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit