Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Range Error/Reference Error issue

New Here ,
Mar 04, 2024 Mar 04, 2024

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?

 

TOPICS
Acrobat SDK and JavaScript , Windows
771
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 04, 2024 Mar 04, 2024

also getting:

InvalidArgsError: Invalid arguments.
Doc.movePage:1:Console undefined:Exec

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 04, 2024 Mar 04, 2024

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)...

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 04, 2024 Mar 04, 2024

This is a error of the internal document structure.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 05, 2024 Mar 05, 2024

Why are you posting here?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 05, 2024 Mar 05, 2024

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Mar 05, 2024 Mar 05, 2024
LATEST
susanavicente805332@gmail.com
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 05, 2024 Mar 05, 2024

Are you sure you selected the full code before running it?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 05, 2024 Mar 05, 2024

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)?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 05, 2024 Mar 05, 2024

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 05, 2024 Mar 05, 2024

thanks for clarifying. yes, the whole string is loaded and executed as one line of code in the console

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 05, 2024 Mar 05, 2024

Does the file have an even number of pages? Can you share it with us?

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