Folder level script

Participant ,
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, Macintosh

Views

1.7K

Likes

Translate

Translate

Report

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

1 Correct Answer

Adobe Community Professional , Jul 17, 2017
Karl Heinz Kremer Adobe Community Professional , 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.

Likes

Translate

Translate
Jump to answer Jump to answer
Adobe Community Professional ,
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?

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Sudha_K AUTHOR
Participant ,
Jul 14, 2017

Copy link to clipboard

Copied

Hi,

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

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Adobe Community Professional ,
Jul 14, 2017

Copy link to clipboard

Copied

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

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Sudha_K AUTHOR
Participant ,
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.

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Adobe Community Professional ,
Jul 14, 2017

Copy link to clipboard

Copied

In your first screenshot you can see this characters.

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Adobe Community Professional ,
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.

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Adobe Community Professional ,
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.

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Sudha_K AUTHOR
Participant ,
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.

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Adobe Community Professional ,
Jul 17, 2017

Copy link to clipboard

Copied

You must remove the characters before app.

What text editor do you use?

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Sudha_K AUTHOR
Participant ,
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.

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Adobe Community Professional ,
Jul 17, 2017

Copy link to clipboard

Copied

Using the ExtendScript Toolkit makes no sense.

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Sudha_K AUTHOR
Participant ,
Jul 17, 2017

Copy link to clipboard

Copied

But for me its throwing the errors.

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Adobe Community Professional ,
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.

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Sudha_K AUTHOR
Participant ,
Jul 17, 2017

Copy link to clipboard

Copied

Ok thank you...

i will check and come back...

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Sudha_K AUTHOR
Participant ,
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

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
TᴀW LATEST
Adobe Community Professional ,
Apr 08, 2018

Copy link to clipboard

Copied

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

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Adobe Community Professional ,
Jul 17, 2017

Copy link to clipboard

Copied

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

Likes

Translate

Translate

Report

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