Skip to main content
Known Participant
July 9, 2019
Question

Script execution within JS Debugger Not Working For Scripts

  • July 9, 2019
  • 2 replies
  • 1673 views

So, I am trying to figure out how to get code to run within the console. It seems like for simple things like 1+2 it works but any functions I have written as a document JS does not work. What am I missing?

For reference, I am splitting some files...

function Split() {

   var totalPages;

   var i;

   var arrNames = [ "SOME ARRAY HERE" ];

   var targetPath  = "/C/Users/SOMEPATH/";

   totalPages = this.numPages;

   try { for (i = 0; i  < totalPages; i++)

         this.extractPages({

            nStart: i,

            cPath: targetPath +arrNames + ".pdf"

         });

        console.println(targetPath +arrNames + ".pdf");

   } catch (e) {

       console.println("Aborted: " + e)

   }

}

This topic has been closed for replies.

2 replies

try67
Community Expert
Community Expert
July 17, 2019

[Question moved to the JavaScript forum]

Bernd Alheit
Community Expert
Community Expert
July 9, 2019

Does you execute the function? Any error message in the console?

silveryneAuthor
Known Participant
July 9, 2019

Yes, I typed Split in console to execute but it actually returned the actual code for the function, which is super duper confusing. None of the console.println showed properly at all.

silveryneAuthor
Known Participant
July 9, 2019

Like, when I say actual code, I meant it literally.

i.e. I typed:

Split

Then this appeared below:

function Split() {

   var totalPages;

   var i;

   var arrNames = [ "SOME ARRAY HERE" ];

   var targetPath  = "/C/Users/SOMEPATH/";

   totalPages = this.numPages;

   try { for (i = 0; i  < totalPages; i++)

         this.extractPages({

            nStart: i,

            cPath: targetPath +arrNames + ".pdf"

         });

        console.println(targetPath +arrNames + ".pdf");

   } catch (e) {

       console.println("Aborted: " + e)

   }

}