Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn More

View all

Sign in to view all badges

How to switch operational focus to the next document tab?

Avatar

Avatar
Ignite 1
Level 1
VolvoOwner77
Level 1

Likes

0 likes

Total Posts

1 post

Correct Reply

0 solutions
Top badges earned
Ignite 1
View profile

Avatar
Ignite 1
Level 1
VolvoOwner77
Level 1

Likes

0 likes

Total Posts

1 post

Correct Reply

0 solutions
Top badges earned
Ignite 1
View profile
VolvoOwner77
Level 1

06-03-2017

Hi,

I am new to JavaScritp as well as the JavaScript API. My end goal is to create a button that will take each page of the currently active document and insert it after the last page of each document in the list. It seems that  app.activeDocs.bringToFront();  and  app.execMenuItem("GoForwardDoc")  only change the current view, not the application's operational focus. Does anybody know of any way to change operational focus?

While writing the code I have set it to not repeat. Currently, it inserts each page of the source into itself even though it should re-run documentFileName+"";

var docs = app.activeDocs;

var source = this.documentFileName;

//var target = app.execMenuItem("GoForwardDoc"); + documentFileName+"";

console.println('The source is ' + source);

if (docs.length <= 1){

app.alert("You must have at least 2 PDF's open for this operation.");

}

else{

app.execMenuItem("GoForwardDoc");

console.println("You are now looking at the target document");

documentFileName+"";

console.println("the target document is " + this.documentFileName);

this.insertPages({nPage:this.numPages-1, cPath: source});

}

This is an older sample - I continued to work on this at home from my laptop to call a function 'getDocName' but the results were identical.

Consol prints:

The source is Doc1.pdf

You are now looking at the target document

the target document is Doc1.pdf

undefined