Copy link to clipboard
Copied
I have run the below script for years without problem or error in older versions of Adobe Pro. This script takes a pdf file with any number of pages and sorts them to make the page starting in the middle of the document +1, the new page 2, and so on, resulting in a new sort that has pages backed up correctly for print purposes.
for (i = 0; i <= this.numPages/2-1; i++)
this.movePage(this.numPages-1, this.numPages/2-i-1);
This year I upgraded to Creative Cloud and am receiving varied results with the script.
On the first set of documents, the script worked without fail. The second returned RangeError on movePage, but now all subsequent tries return:
ReferenceError: i is not defined
1:Console:Exec
undefined
Any idea what's not working?
Copy link to clipboard
Copied
also getting:
InvalidArgsError: Invalid arguments.
Doc.movePage:1:Console undefined:Exec
Copy link to clipboard
Copied
and now also this:
RaiseError: Expected an array object.
Doc.movePage:1:Console undefined:Exec
===> Expected an array object.
undefined
but when run on a different document, the script executes perfectly (just not the ones i need to run on)...
Copy link to clipboard
Copied
This is a error of the internal document structure.
Copy link to clipboard
Copied
Why are you posting here?
Copy link to clipboard
Copied
How so - what should I be looking for? The documents have been created the same way, from the same database year over year. Moreover, in this current batch, some of the compiled documents (from said same database) work, while others do not. There is no pattern to the failed execution.
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Are you sure you selected the full code before running it?
Copy link to clipboard
Copied
Yes. The code in the original post is the only string I have used. And until this year, has run successfully.
Perhaps there's an update to one of the functions on the JS or Adobe side that no longer recognized in my old code (i.e. movePages is called something different)?
Copy link to clipboard
Copied
The code could be the same but the way you execute it might not be. The error message suggests you're only executing the second line of code. So I repeat, are you SURE you selected the full code with the mouse or keyboard before running it?
And nothing changed in the way the movePage method functions.
Copy link to clipboard
Copied
thanks for clarifying. yes, the whole string is loaded and executed as one line of code in the console
Copy link to clipboard
Copied
Does the file have an even number of pages? Can you share it with us?
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more