Article View: adobe.scripting.indesign
Article #18722Re: How can I change the tool in the UI [AS]?
From: Olivier Berquin
Date: Wed, 26 Feb 2003 07:48
Date: Wed, 26 Feb 2003 07:48
37 lines
2033 bytes
2033 bytes
Alan,
Thanks !
This is my final script; This script compare the horizontal scale and the vertical scale, add 0,5 % to the image and center it in the frame. So, the image fit the frame completely and proportionally !
tell document 1 of application "InDesign 2.0.2"
activate
set theSelection to selection
set theClass to class of item 1 of theSelection
if theClass is in {oval, rectangle, polygon} then
set theTarget to theSelection
else if theClass is in {PDF, EPS, image} then
try
set theTarget to parent of theSelection
on error
try
set theTarget to parent of item 1 of theSelection
end try
end try
else
error number -128 -- do your stuff here
end if
tell item 1 of theTarget
fit given content to frame -- anamorphic fit
set horScale to (horizontal scale of page item 1) + 0.5
set vertScale to (vertical scale of page item 1) + 0.5
if horScale is greater than vertScale then
set vertical scale of page item 1 to horScale
set horizontal scale of page item 1 to horScale
else
set horizontal scale of page item 1 to vertScale
set vertical scale of page item 1 to vertScale
end if
fit given center content -- centre it
end tell
end tell
Technical Details
Message-ID:
<1de803ec.1@WebX.la2eafNXanI>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-08!supernews.com!38.144.126.75.MISMATCH!feed1.newsreader.com!newsreader.com!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!eusc.inter.net!newsfeed01.sul.t-online.de!t-online.de!WebXReferences:
<1de803ec.-1@WebX.la2eafNXanI>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f939a,f3eb1f4e74209329 X-Google-Attributes: gidf939a,public X-Google-ArrivalTime: 2003-02-26 00:07:56 PST From: "Olivier Berquin" <olb@microscript.com> Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-08!supernews.com!38.144.126.75.MISMATCH!feed1.newsreader.com!newsreader.com!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!eusc.inter.net!newsfeed01.sul.t-online.de!t-online.de!WebX Newsgroups: adobe.scripting.indesign Subject: Re: How can I change the tool in the UI [AS]? Message-ID: <1de803ec.1@WebX.la2eafNXanI> Date: Tue, 25 Feb 2003 23:48:24 -0800 References: <1de803ec.-1@WebX.la2eafNXanI> Lines: 39 MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit