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

Folder level script

Contributor ,
Jul 11, 2017 Jul 11, 2017

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
3.7K
Translate
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.

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

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

Did you create the js file with a text editor?

Translate
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

Hi,

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

Translate
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

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

Translate
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

     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.

Translate
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

In your first screenshot you can see this characters.

Translate
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

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.


Acrobate du PDF, InDesigner et Photoshopographe
Translate
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

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

Translate
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

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.

Translate
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

You must remove the characters before app.

What text editor do you use?

Translate
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

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.

Translate
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

Using the ExtendScript Toolkit makes no sense.

Translate
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

But for me its throwing the errors.

Translate
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

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.

Translate
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

Ok thank you...

i will check and come back...

Translate
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

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

Translate
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
LATEST

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

Translate
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

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


Acrobate du PDF, InDesigner et Photoshopographe
Translate
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