🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: adobe.scripting.indesign
Article #18151

Re: MakeGuidesByPercentage problem

#18151
From: Kari Puikkonen
Date: Wed, 16 Apr 2003 21:42
81 lines
3785 bytes
Olivier,

Thnak you for your advise, but unfortunately it did't work.
Now I get error: Can't get guide. Access not allowed.

I also tried this approach but got the same error:



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 
	set myDocumentPreferences to document preferences of myDocument

	set myMarginPreferences to margin preferences of page 1 of myDocument 
	set myLeftMargin to margin left of myMarginPreferences 
	set myRightMargin to margin right of myMarginPreferences 
	set myTopMargin to margin top of myMarginPreferences 
	set myBottomMargin to margin bottom of myMarginPreferences 
	set myLiveWidth to (page width of myDocumentPreferences) - (myLeftMargin + myRightMargin) 
	set myLiveHeight to (page height of myDocumentPreferences) - (myTopMargin + myBottomMargin)

	tell page 1 of my document 
		repeat with myGuidePercent in myXPercentages 
			set myGuide to make guide with properties {orientation:vertical, location:(myGuidePercent * 0.01) * myLiveWidth} 
		end repeat 
		repeat with myGuidePercent in myYPercentages 
			set myGuide to make guide with properties {orientation:horizontal, location:(myGuidePercent * 0.01) * myLiveHeight} 
		end repeat 
	end tell 
end tell



I also got the same error with this approach:



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 myMarginPreferences to margin preferences 
	tell myMarginPreferences 
		set margin top to 15 
		set margin bottom to 10 
		set margin left to 7 
		set margin right to 7 
	end tell 
	set myDocument to make document 
	set myDocumentPreferences to document preferences 
	tell myDocumentPreferences 
		set pages per document to 1 
		set page orientation to portrait 
	end tell 
	set ruler origin of view preferences of myDocument to page origin 
	set myMarginPreferences to margin preferences 
	repeat with i from 1 to (count every page of myDocument) 
		tell page i of myDocument 
			set myPageHeight to (page height of document preferences of myDocument) - ((margin top of myMarginPreferences) + (margin bottom of myMarginPreferences)) 
			set myPageWidth to (page width of document preferences of myDocument) - ((margin left of myMarginPreferences) + (margin right of myMarginPreferences)) 
		end tell 
	end repeat

	tell page 1 of my document 
		repeat with myGuidePercent in myXPercentages 
			set myGuide to make guide with properties {orientation:vertical, location:(myGuidePercent * 0.01) * myPageWidth} 
		end repeat 
		repeat with myGuidePercent in myYPercentages 
			set myGuide to make guide with properties {orientation:horizontal, location:(myGuidePercent * 0.01) * myPageHeight} 
		end repeat 
	end tell 
end tell



Darn, these calculations are difficult!

Kari
Technical Details
Message-ID: <1de8b795.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!news-out.visi.com!petbe.visi.com!eusc.inter.net!newsfeed01.sul.t-online.de!t-online.de!WebX
References: <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-16 15:07:42 PST
From: "Kari Puikkonen" <kari.puikkonen@welho.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-08!supernews.com!news-out.visi.com!petbe.visi.com!eusc.inter.net!newsfeed01.sul.t-online.de!t-online.de!WebX
Newsgroups: adobe.scripting.indesign
Subject: Re: MakeGuidesByPercentage problem
Message-ID: <1de8b795.1@WebX.la2eafNXanI>
Date: Wed, 16 Apr 2003 14:42:14 -0700
References: <1de8b795.-1@WebX.la2eafNXanI>
Lines: 85
MIME-Version: 1.0
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit