🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: adobe.scripting.indesign
Article #15362

Re: Desperate for imposition/build booklet script for CS! (for PC)

#15362
From: Dave_Saunders
Date: Sun, 30 Nov 2003 00:59
36 lines
2513 bytes
This JavaScript will do the job. I posted it once before with some logic that allowed it to work on a copy of the active document, but it seems that what I did to achieve that was platform dependent.

This script will work on either Mac or PC. Just use a text editor to save it with a .js extension in your Scripts folder. I advise running it on a copy of your document. The document must be an exact multiple of four pages and it must be set up with Facing Pages. When the script finishes, the pages will have been shuffled into printer spreads which you can print or export to PDF with the Spreads option checked.

The script makes no allowance for items that cross the binding. You'll have to check for such occurrences and deal with them yourself. Still, this should tide people over until something better comes along.

Dave

//DESCRIPTION: Minimalist Build Booklet

myPages = app.documents[0].pages;

// Let's make sure that the pages are a multiple of four
app.documents[0].documentPreferences.allowPageShuffle = false;

if (Math.round(myPages.length/4)*4 != myPages.length) {
	alert("Document length isn't a multiple of four.");
	exit();
}

	for (i=0; i<myPages.length; i++) {
		newSection = app.documents[0].sections.add(undefined,undefined,{pageStart:app.documents[0].pages[i],continueNumbering:false,pageNumberStart:(i+1)});
	}
	app.documents[0].documentPreferences.allowPageShuffle = true;

	for (i=0; i<(myPages.length/2); i++){
		if (isEven(i)) {
			app.documents[0].pages[myPages.length - 1].move(LocationOptions.before,app.documents[0].pages[i*2],BindingOptions.leftAlign);
	} else {
			app.documents[0].pages[myPages.length - 1].move(LocationOptions.after,app.documents[0].pages[i*2],BindingOptions.rightAlign);
	}
}

function isEven(n) {
	return ((Math.round(n/2))*2 == n);
}
Technical Details
Message-ID: <2ccea794.0@webx.la2eafNXanI>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!fu-berlin.de!newsfeed01.sul.t-online.de!t-online.de!webx
References: <FAC941F81E796E960C9BF422FD539A86@in.webx.la2eafNXanI>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f939a,17840a6db56c0f55
X-Google-Attributes: gidf939a,public
X-Google-ArrivalTime: 2003-11-29 17:07:36 PST
From: Dave_Saunders@adobeforums.com
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!fu-berlin.de!newsfeed01.sul.t-online.de!t-online.de!webx
Newsgroups: adobe.scripting.indesign
Subject: Re: Desperate for imposition/build booklet script for CS! (for PC)
Message-ID: <2ccea794.0@webx.la2eafNXanI>
Date: Sat, 29 Nov 2003 16:59:52 -0800
References: <FAC941F81E796E960C9BF422FD539A86@in.webx.la2eafNXanI>
Lines: 49
MIME-Version: 1.0
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit