Syntax error in InDesign script: 'a identifier cannot go after go'

i'm attempting to run the following script in InDesign:

var doc = app.documents[0];

var numPages = doc.pages.length;

for (var n = 0; n < numPages - 1; n++) {

  doc.pages[n].textFrames[0].nextTextFrame = doc.pages[n + 1].textFrames[0];


but am getting this error message:


[Edited by Moderator]

Original Title: When running a script in script editor, I keep getting the following error: Syntax error: a identifier cannot go after go after this identifier.

Posted on Jul 28, 2025 8:56 PM

Reply
Question marked as Top-ranking reply

Posted on Jul 29, 2025 1:55 AM

You are trying to write an AppleScript, but your syntax is totally wrong for it.

There is no "var" word in AppleScript. There is no C-style for structure in Applescript.


Maybe you intended to use JavaScript instead?



4 replies

Jul 29, 2025 7:08 AM in response to kriss33

The Script Editor supports AppleScript and Java Script for Automation. Click that AppleScript selector and change it to JavaScript. The syntax would still be wrong to manipulate InDesign. On the Script Editor File menu, choose Open Dictionary and scroll down until you see Adobe InDesign. Open that scripting dictionary and on its toolbar, change the default AppleScript to JavaScript.


This is also not the place to get help with JavaScript (JXA) coding either as there are very few writing it now. See Adobe's InDesign support community.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Syntax error in InDesign script: 'a identifier cannot go after go'

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.