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.
How can I clear it to make script to work for startup script??
- Sudha K
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.
Copy link to clipboard
Copied
You must remove this part: \xD4\xAA\xF8
Did you create the js file with a text editor?
Copy link to clipboard
Copied
Hi,
Sorry for delayed response. I have created js file using extended toolkit.
Copy link to clipboard
Copied
Did you remove the characters \xD4\xAA\xF8 ?
Copy link to clipboard
Copied
I could not find those characters in that file.
I can run and see the output from console. But could not see output from folder script.
Copy link to clipboard
Copied
In your first screenshot you can see this characters.
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.
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.
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.
Copy link to clipboard
Copied
You must remove the characters before app.
What text editor do you use?
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.
Copy link to clipboard
Copied
Using the ExtendScript Toolkit makes no sense.
Copy link to clipboard
Copied
But for me its throwing the errors.
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.
Copy link to clipboard
Copied
Ok thank you...
i will check and come back...
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
Copy link to clipboard
Copied
ESTK has an option in preferences (under the Document tab): "Don't write UTF-8 signature"...
Copy link to clipboard
Copied
TextWrangler died, welcome to the new BBEdit : Bare Bones Software | Upgrade to BBEdit