🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: adobe.scripting.indesign
3 messages
3 total messages Started by oblok Wed, 25 Mar 2009 19:12
help jsx -> VB
#307
Author: oblok
Date: Wed, 25 Mar 2009 19:12
112 lines
3703 bytes
hi,
how this script remake to vb language ??

f (app.documents.length != 0) {
	result = buildBooklet(app.documents[0]);
	if (result != null) {
		alert(result);
	}
}

function buildBooklet() {

	var myPages = app.documents[0].pages;
	if (myPages.length % 4 != 0) {
		return("Document length isn't a multiple of four.");
	}

	if (app.documents[0].modified) {
		if (confirm("Document has unsaved changes. Click OK to save them and proceed.")){
			app.documents[0].save(app.documents[0].fullName);
		} else {
			return null;
		}
	}





	if (app.version == 3) {
		app.userInteractionLevel = UserInteractionLevels.neverInteract;
	} else {
		app.scriptPreferences.userInteractionLevel = UserInteractionLevels.neverInteract;
	}

	var myFN = app.documents[0].fullName;
	var myName = app.documents[0].name;
	var n = 0;
	var myTN = app.documents[0].filePath + "/" + myName.split(".indd")[0] + n + ".indt";
	while (File(myTN).exists) {
		n++;
		myTN = app.documents[0].filePath + "/" + myName.split(".indd")[0] + n+ ".indt";
	}
	app.documents[0].save(File(myTN),true);
	app.documents[0].close();
	app.open(File(myTN));
	File(myTN).remove();

	if (app.version == 3) {
		app.userInteractionLevel = UserInteractionLevels.interactWithAll;
	} else {
		app.scriptPreferences.userInteractionLevel = UserInteractionLevels.interactWithAll;
	}

	app.documents[0].documentPreferences.allowPageShuffle = false;

	for (i=0; myPages.length > i; i++) {
	 var origSection = myPages[i].appliedSection;
	 var origNumbering = origSection.pageNumberStyle;
	 origSection.pageNumberStyle = PageNumberStyle.arabic;
	 var pageName = myPages[i].name;
	 var sectName = origSection.name;
	 if (sectName != "") {

		var testPageName = pageName.split(sectName)[1];
		if (testPageName != null) {
			pageName = testPageName;
		}
	 }
	 var pageNo = Number(pageName);

	 if (app.version == 3){
		newSection = app.documents[0].sections.add(undefined, undefined, {
			pageStart:app.documents[0].pages[i],
			continueNumbering:false,
			pageNumberStart:pageNo,
			pageNumberStyle:origNumbering,
			marker: origSection.marker,
			name: origSection.name
		});
		origSection.pageNumberStyle = origNumbering;
	 } else {
		newSection = app.documents[0].sections.add({
			pageStart:app.documents[0].pages[i],
			continueNumbering:false,
			pageNumberStart:pageNo,
			pageNumberStyle:origNumbering,
			marker: origSection.marker,
			name: origSection.name
		});
		origSection.pageNumberStyle = origNumbering;
	 }
	}
	app.documents[0].documentPreferences.allowPageShuffle = true;

	for (i=0; (myPages.length/2)>i; i++){
	 if (i % 2 == 0) {
		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);
	 }
	}





	app.activeDocument.textPreferences.zOrderTextWrap = !app.activeDocument.textPreferences.zOrderTextWrap;
	app.activeDocument.textPreferences.zOrderTextWrap = !app.activeDocument.textPreferences.zOrderTextWrap;
}

thx
Re: Help imposition JSX -> VB
#312
Author: Dave_Saunders
Date: Wed, 25 Mar 2009 20:29
5 lines
980 bytes
Maybe you should ask the original author's permission?

Ah what the hell, go for it. Why do you need it translated? Why not just run it as a JavaScript? If you need to trigger it from VBA you could use a doScript. Probably easier than converting the whole script -- can VBA do the kinds of thing I do in the middle to get an untitled copy of the document opened?

Dave
Re: Help imposition JSX -> VB
#345
Author: Marcin Ruszala
Date: Thu, 26 Mar 2009 16:42
2 lines
848 bytes
hi
just a little bit modify and write by my way that' s why I wanted to use it as a base of my own script. I'd like to write it in VBA because I know it and it would be easier for me. But mabe you have another way to making imposition ?
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads