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

Folder level script

Contributor ,
Jul 11, 2017 Jul 11, 2017

Copy link to clipboard

Copied

Hi,

     I need to create menu item when acrobat opens.  So i have placed the script in the path of user level path. when i use the code for app level its working and added menu item but in folder level its not working.

https://acrobatusers.com/tutorials/folder_level_scripts  (Ref)

app.addMenuItem({cName:"JS Ref", cParent:"Help", cExec:"app.openDoc('pathToPDF');"});

When I check the console its showing the below error.

Screen shot 2017-07-12 at 7.58.55 AM.png

How can I clear it to make script to work for startup script??

- Sudha K

TOPICS
Acrobat SDK and JavaScript

Views

3.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 , Jul 17, 2017 Jul 17, 2017

Based on your screenshot, you are on a Mac. Here is somebody else with the same problem: Folder Level Help

Don't use ExtendScriptTK - it's not a "normal" text editor. TextWrangler should be OK, but don't paste your code from ESTK, start from scratch.

Votes

Translate

Translate
Community Expert ,
Jul 11, 2017 Jul 11, 2017

Copy link to clipboard

Copied

You must remove this part: \xD4\xAA\xF8

Did you create the js file with a text editor?

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
Contributor ,
Jul 14, 2017 Jul 14, 2017

Copy link to clipboard

Copied

Hi,

     Sorry for delayed response.  I have created js file using extended toolkit.

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 ,
Jul 14, 2017 Jul 14, 2017

Copy link to clipboard

Copied

Did you remove the characters \xD4\xAA\xF8 ?

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
Contributor ,
Jul 14, 2017 Jul 14, 2017

Copy link to clipboard

Copied

     I could not find those characters in that file.

Screen shot 2017-07-14 at 2.05.56 PM.png

I can run and see the output from console.  But could not see output from folder script.

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 ,
Jul 14, 2017 Jul 14, 2017

Copy link to clipboard

Copied

In your first screenshot you can see this characters.

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 ,
Jul 12, 2017 Jul 12, 2017

Copy link to clipboard

Copied

Here is my custom script to do the same thing, I use it every day:

function openJSref() {

    app.openDoc("/MacBookPro//Users/jrb/hubiC/Docs/Acrobat & PDFs/AA SDKs/AcDC SDK/Acrobat_DC_SDK_Documentation/AcrobatDC_js_api_reference.pdf");  

}

//  

function openJSref2() {

    app.openDoc("/MacBookPro//Users/jrb/hubiC/Docs/Acrobat & PDFs/AA SDKs/AcDC SDK/Acrobat_DC_SDK_Documentation/AcrobatDC_js_developer_guide.pdf");  

}  

app.addMenuItem({ cName: "-", cParent: "File", cEnable: false, cExec:null});

app.addSubMenu({cName: "Utilitaires", cParent: "File"});

app.addMenuItem({cName: "JS Reference...", cParent: "Utilitaires", cExec: "openJSref()"});

app.addMenuItem({cName: "JS Guide...", cParent: "Utilitaires", cExec: "openJSref2()"});

Don't forget to edit file paths.

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
LEGEND ,
Jul 15, 2017 Jul 15, 2017

Copy link to clipboard

Copied

You need to replace " 'pathToPDF' " with the real path name and file name to open not place holder/instruction text.

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
Contributor ,
Jul 17, 2017 Jul 17, 2017

Copy link to clipboard

Copied

Hi,

     I have used correct path in the script.  pathToPDF is sample text.  Used correct path pls check my last reply.

     Also My first screenshot is output console screen shot for the error msgs. I can run that from console for an active document  but could not get the output for startup process to add menu in application.

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 ,
Jul 17, 2017 Jul 17, 2017

Copy link to clipboard

Copied

You must remove the characters before app.

What text editor do you use?

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
Contributor ,
Jul 17, 2017 Jul 17, 2017

Copy link to clipboard

Copied

I have check ExtendScript Toolkit and Textwrangle for startup script save. But the code is copied code from javascript script console from acrobat. Sar error msg from acrobat javascript console.

For Active document used used javascript consol.

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 ,
Jul 17, 2017 Jul 17, 2017

Copy link to clipboard

Copied

Using the ExtendScript Toolkit makes no sense.

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
Contributor ,
Jul 17, 2017 Jul 17, 2017

Copy link to clipboard

Copied

But for me its throwing the errors.

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 ,
Jul 17, 2017 Jul 17, 2017

Copy link to clipboard

Copied

Based on your screenshot, you are on a Mac. Here is somebody else with the same problem: Folder Level Help

Don't use ExtendScriptTK - it's not a "normal" text editor. TextWrangler should be OK, but don't paste your code from ESTK, start from scratch.

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
Contributor ,
Jul 17, 2017 Jul 17, 2017

Copy link to clipboard

Copied

Ok thank you...

i will check and come back...

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
Contributor ,
Jul 20, 2017 Jul 20, 2017

Copy link to clipboard

Copied

Hi,

     I have checked as you said its working for me.. thank you so much...

     Issue is editor only. I have used TextWrangler, now its working.  Menu item is added as startup.

     Thanks a lot.

     I need to get pdf page ranges as report. I have the below code for batch process.  But i dono to write report as xl or csv. We can open save as file dialog from console but how can i do this process.

Code:

   if(global.dataLine == "undefined")

   {

        global.dataLine = "";  

    }

    var docName = this.documentFileName;

    var startPgNo = this.getPageLabel(0);

    var lastPgNo = this.getPageLabel(this.numPages-1);

    var docPgRange = startPgNo + "-"+ lastPgNo

    app.alert("docPgRange" +docPgRange)

    global.dataLine = global.dataLine + docName + "," + docPgRange + "\n";

    app.alert("dataLine" +global.dataLine);

How can i call batch process from menu item and save as report??

-  Sudha K

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
People's Champ ,
Apr 08, 2018 Apr 08, 2018

Copy link to clipboard

Copied

LATEST

ESTK has an option in preferences (under the Document tab): "Don't write UTF-8 signature"...

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 ,
Jul 17, 2017 Jul 17, 2017

Copy link to clipboard

Copied

TextWrangler died, welcome to the new BBEdit : Bare Bones Software | Upgrade to BBEdit

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