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

Illegal Character 1 Error

Engaged ,
Jan 19, 2018 Jan 19, 2018

Copy link to clipboard

Copied

I am running Acrobat Pro XI on a Windows 7 computer. I have placed the following code on a button so when the user clicks it the layer

"L730-A26" will turn off.

var colorLayer = "L730-A26";

var ocgSchematicArray = this.getOCGs(this.pageNum);

for (var i=0; i < ocgSchematicArray.length; i++){

    if (ocgSchematicArray.name == colorLayer){

        ocgSchematicArray.state = false;

        }

    }

I am getting this message:

errorMessage.JPG

I have run this exact code in the exact same way on another file without issue. I have deleted all the code and typed it all out (no copy and paste) to eliminate the possibility of odd characters from pasting.

Still no success. Can someone please tell me what I am doing wrong?

TOPICS
Acrobat SDK and JavaScript , Windows

Views

1.2K

Translate

Translate

Report

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

correct answers 1 Correct answer

Community Expert , Jan 22, 2018 Jan 22, 2018

ExtendScript is not a general purpose JavaScript editor. Use either the internal editor or a tool like NotePad++

Votes

Translate

Translate
Community Expert ,
Jan 19, 2018 Jan 19, 2018

Copy link to clipboard

Copied

Your code looks OK (and when I copy&paste into a new document, it does not give me the syntax error). Do you have any other scripts in your document? What happens when you try to add the script line by line, or block by block? You can start out with just the first line, then add the second line, then create the for statement, but with an empty loop body. And so on.

Is there anything past the end of the script that you've posted? Can you share the file?

Votes

Translate

Translate

Report

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
Engaged ,
Jan 19, 2018 Jan 19, 2018

Copy link to clipboard

Copied

I don't have any code at the document level and nothing else besides what I posted on the button. I will try to paste it in line by line as you suggested. I can't share the file due to it's content being trademarked. I will post back after I try the line by line. Thank you for your help and quick response!

Votes

Translate

Translate

Report

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
Engaged ,
Jan 19, 2018 Jan 19, 2018

Copy link to clipboard

Copied

I get the same error on every line. So I deleted the document and started over. I created a brand new button and put the first line on it. Same error. Then same error for every line by itself. I really don't get what is going on. Again no copy and paste. Have rebooted the computer. Have recreated the file. Same error every time.

Votes

Translate

Translate

Report

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 ,
Jan 19, 2018 Jan 19, 2018

Copy link to clipboard

Copied

In what application are you writing the code?

Votes

Translate

Translate

Report

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
Engaged ,
Jan 22, 2018 Jan 22, 2018

Copy link to clipboard

Copied

I'm writing the code in Adobe Extendscript Toolkit CC. I'll try switching to the internal editor in Acrobat and see if that resolves the issue.

Thank you all for the replies!

Votes

Translate

Translate

Report

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 ,
Jan 22, 2018 Jan 22, 2018

Copy link to clipboard

Copied

ExtendScript is not a general purpose JavaScript editor. Use either the internal editor or a tool like NotePad++

Votes

Translate

Translate

Report

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
Engaged ,
Jan 22, 2018 Jan 22, 2018

Copy link to clipboard

Copied

LATEST

I switched to NotePad++ and works perfectly! Thank you! I have never had an issue like this before. Grateful for the suggestions/help!

Votes

Translate

Translate

Report

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 ,
Jan 19, 2018 Jan 19, 2018

Copy link to clipboard

Copied

The illegal character is probably an invisible character inserted by your editing application.

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

Votes

Translate

Translate

Report

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 ,
Jan 19, 2018 Jan 19, 2018

Copy link to clipboard

Copied

What happens when you fix it?

Votes

Translate

Translate

Report

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
Engaged ,
Jan 19, 2018 Jan 19, 2018

Copy link to clipboard

Copied

All it does is takes me back in to allow me to edit the code

Votes

Translate

Translate

Report

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