Article View: adobe.scripting.indesign
Article #18277MakeGuidesByPercentage problem
From: Kari Puikkonen
Date: Sat, 12 Apr 2003 23:07
Date: Sat, 12 Apr 2003 23:07
59 lines
2972 bytes
2972 bytes
I tried to fix Ole's MakeGuidesByPercentage script to take note of margins, but I get error: Can't make this and that into a number.
--MakeGuidesByPercentage.scpt
--An InDesign 2.x script
--Places guides on a page based on a list of percentages of page height/page width.
--
--Enter the horizontal locations you want as percentages in the following list.
set myXPercentages to {25, 50, 75}
--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 make document
tell myDocument
set myPage to page 1
set myBoundsVertical to my myGetPageBoundsVertical(myPage, myDocument)
set myBoundsHorizontal to my myGetPageBoundsHorizontal(myPage, myDocument)
end tell
tell page 1 of my document
repeat with myGuidePercent in myXPercentages
set myGuide to make guide with properties {orientation:vertical, location:(myGuidePercent * 0.01) * myBoundsHorizontal}
end repeat
repeat with myGuidePercent in myYPercentages
set myGuide to make guide with properties {orientation:horizontal, location:(myGuidePercent * 0.01) * myBoundsVertical}
end repeat
end tell
end tell
on myGetPageBoundsVertical(myPage, myDocument)
tell application "InDesign 2.0.2"
set myMarginPreferences to margin preferences of myPage
set myDocumentPreferences to document preferences of myDocument
tell myPage
set myY1 to margin top of myMarginPreferences
set myY2 to (page height of myDocumentPreferences) - (margin bottom of myMarginPreferences)
end tell
end tell
return {myY1, myY2}
end myGetPageBoundsVertical
on myGetPageBoundsHorizontal(myPage, myDocument)
tell application "InDesign 2.0.2"
set myMarginPreferences to margin preferences of myPage
set myDocumentPreferences to document preferences of myDocument
tell myPage
set myX1 to margin left of myMarginPreferences
set myX2 to (page width of myDocumentPreferences) - (margin right of myMarginPreferences)
end tell
end tell
return {myX1, myX2}
end myGetPageBoundsHorizontal
What I'm doing wrong?
Kari (The Learning To Handling Handlers Man)
Technical Details
Message-ID:
<1de8b795.-1@WebX.la2eafNXanI>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!sn-xit-01!sn-xit-09!supernews.com!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed.freenet.de!eusc.inter.net!newsfeed01.sul.t-online.de!t-online.de!WebXShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f939a,bdb611021b292e3b,start X-Google-Attributes: gidf939a,public X-Google-ArrivalTime: 2003-04-12 16:37:35 PST From: "Kari Puikkonen" <kari.puikkonen@welho.com> Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!sn-xit-01!sn-xit-09!supernews.com!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed.freenet.de!eusc.inter.net!newsfeed01.sul.t-online.de!t-online.de!WebX Newsgroups: adobe.scripting.indesign Subject: MakeGuidesByPercentage problem Message-ID: <1de8b795.-1@WebX.la2eafNXanI> Date: Sat, 12 Apr 2003 16:07:35 -0700 Lines: 65 MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit