Which JavaScript goes to the last page of the indesign active document?

New Here ,
Jan 07, 2021

Copy link to clipboard

Copied

Hi~

Do you want to know JavaScript that goes to the last page when I open a document in In Design? Help me~

 

var myDoc = app.activeDocument;
var myPages = myDoc.pages;
var lastPage = myPages.count();
 
 for (var p = lastPagep <= lastPage - 1p++) {
  ......
}
 
TOPICS
Scripting

Views

82

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

Which JavaScript goes to the last page of the indesign active document?

New Here ,
Jan 07, 2021

Copy link to clipboard

Copied

Hi~

Do you want to know JavaScript that goes to the last page when I open a document in In Design? Help me~

 

var myDoc = app.activeDocument;
var myPages = myDoc.pages;
var lastPage = myPages.count();
 
 for (var p = lastPagep <= lastPage - 1p++) {
  ......
}
 
TOPICS
Scripting

Views

83

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Jan 07, 2021 0
Adobe Community Professional ,
Jan 08, 2021

Copy link to clipboard

Copied

Hi,

 

Do you mean actually move what the user sees on the screen to tha last page? OR

get the last page in your script so you can do something with it?

 

Malcolm

 

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jan 08, 2021 0
New Here ,
Jan 08, 2021

Copy link to clipboard

Copied

I'd like to create a new page on the last page of the document and create multiple text frames with a repeating statement.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jan 08, 2021 0
Adobe Community Professional ,
Jan 08, 2021

Copy link to clipboard

Copied

This makes the last page active:

 

var pc = app.activeDocument.pages.length;
var lp = app.activeDocument.pages[pc-1];
app.activeWindow.activePage=lp;

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jan 08, 2021 0
New Here ,
Jan 08, 2021

Copy link to clipboard

Copied

I'd like to create a new page on the last page of the document and create multiple text frames with a repeating statement.

What should I do?

 

var pc = app.activeDocument.pages.length;

var lp = app.activeDocument.pages[pc-1];

app.activeWindow.activePage=lp;

 
for (var p = pcp <= lpp++) {
       .....
}

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jan 08, 2021 0
SychevKA LATEST
Participant ,
Jan 08, 2021

Copy link to clipboard

Copied

hi, this example is especially for you:

function main(){
	var rules_align = Number(app.activeDocument.viewPreferences.rulerOrigin)
	app.activeDocument.viewPreferences.rulerOrigin = 1380143215
	
	app.activeDocument.pages.add(LocationOptions.AT_END)
	for(var i = 0; i < 3; i++){
		var mytextframe = app.activeDocument.pages.item(-1).textFrames.add()
		mytextframe.geometricBounds = [0+i*5,0,5+i*5,25]
		mytextframe.contents = 'hello world !'
	}
	
	app.activeDocument.viewPreferences.rulerOrigin = rules_align
}

app.doScript('main()', ScriptLanguage.JAVASCRIPT, undefined, UndoModes.ENTIRE_SCRIPT, 'hello world !')

 

 

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jan 08, 2021 0