Article View: adobe.scripting.indesign
Article #18177Re: MakeGuidesByPercentage problem
From: Kari Puikkonen
Date: Thu, 17 Apr 2003 13:50
Date: Thu, 17 Apr 2003 13:50
39 lines
2529 bytes
2529 bytes
Well, what you know!
With the GREAT help from Olivier, here is the final script:
set myXPercentages to {25, 50, 75}
--MakeGuidesByPercentage(margins).scpt
--Places guides on a page based on a list of percentages of page margins height/page margins width.
--
--Enter the horizontal locations you want as percentages in the following list.
--Enter the vertical locations you want as percentages in the following list.
set myYPercentages to {25, 50, 75}
tell application "InDesign 2.0.2"
set myDocument to active document
tell myDocument
set myPage to page 1
set myPageHeight to page height of document preferences of myDocument
set myPageWidth to page width of document preferences of myDocument
set myMarginPreferences to margin preferences of myPage
set theLiveWidth to myPageWidth - (margin left of myMarginPreferences) - (margin right of myMarginPreferences)
set theLiveHeight to myPageHeight - (margin top of myMarginPreferences) - (margin bottom of myMarginPreferences)
tell page 1 of myDocument
repeat with myGuidePercent in myXPercentages
set myGuide to make guide with properties {orientation:vertical, location:((myGuidePercent * 0.01) * theLiveWidth) + (margin left of myMarginPreferences)}
end repeat
repeat with myGuidePercent in myYPercentages
set myGuide to make guide with properties {orientation:horizontal, location:((myGuidePercent * 0.01) * theLiveHeight) + (margin top of myMarginPreferences)}
end repeat
end tell
end tell
end tell
Only sad thing is that I didn't learn to do this with handler/subroutine, but maybe this is impossible to do that way...
Kari
Technical Details
Message-ID:
<1de8b795.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-06!sn-xit-09!supernews.com!news.maxwell.syr.edu!peernews-us.colt.net!newsfeed.news2me.com!newsfeed.icl.net!newsfeed.fjserv.net!lnewspeer00.lnd.ops.eu.uu.net!emea.uu.net!newsfeed01.sul.t-online.de!t-online.de!WebXReferences:
<1de8b795.-1@WebX.la2eafNXanI>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f939a,bdb611021b292e3b X-Google-Attributes: gidf939a,public X-Google-ArrivalTime: 2003-04-17 07:08:12 PST From: "Kari Puikkonen" <kari.puikkonen@welho.com> Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-03!sn-xit-01!sn-xit-06!sn-xit-09!supernews.com!news.maxwell.syr.edu!peernews-us.colt.net!newsfeed.news2me.com!newsfeed.icl.net!newsfeed.fjserv.net!lnewspeer00.lnd.ops.eu.uu.net!emea.uu.net!newsfeed01.sul.t-online.de!t-online.de!WebX Newsgroups: adobe.scripting.indesign Subject: Re: MakeGuidesByPercentage problem Message-ID: <1de8b795.4@WebX.la2eafNXanI> Date: Thu, 17 Apr 2003 06:50:32 -0700 References: <1de8b795.-1@WebX.la2eafNXanI> Lines: 45 MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit