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

launchURL for local bat file not working

New Here ,
Feb 01, 2022 Feb 01, 2022

I'm struggling attempting to get a document level script working that uses the lauchURL method.  I'm attempting to run a local bat file.  I've experimented with various syntax options, but when I test the code in the console, it just responds as undefined.  I thought that the correct syntax was: app.launchURL("file:///c/users/rick/documents/test bat.bat", true);

Again, I tried every format I can think of, but it won't work.  I've also tried as a trusted function, but no luck.

 

Any suggestions?  Will this just not work in Acrobat Reader?

TOPICS
General troubleshooting , How to , PDF forms
1.6K
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 ,
Feb 01, 2022 Feb 01, 2022

I would expect, hope and indeed demand that file: URLs be blocked for security reasons. And that even if they weren't. that executable files would be blocked. Since PDF files can be downloaded, and can run JavaScript while seeming to be an innocent document, there are lot of things that cannot be done.

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 ,
Feb 01, 2022 Feb 01, 2022

There is no way that you can launch an executable from an Acrobat script. Nor should you. This would be a serious security violation.

So, what exactly are you trying to do? Maybe there is a better solution.  

 

 

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

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
New Here ,
Feb 01, 2022 Feb 01, 2022

The JavaScript Reference manual shows launchURL as a "S" secure method, so I tried executing it as a trusted function but still was unable to get it to work.  I understand the security considerations.  That said, when I test the code in the console, a response of just "undefined" doesn't clarify much!

 

I'll figure something out.  I'm trying to support users who are not computer savvy.  They need to open blank pdf templates, update them based on client interviews, and have them named properly (unique file names using form field data), saved in a designated local folder, and then uploaded to a secure NAS folder for consolidation purposes.  I've automated most of this to eliminate potential errors.  A single PDF form allows them to hit buttons that open the correct pdf templates, then document scripts name and save the pdf files (without saving over the templates), and a local script (vbs) uploads new pdf's to the correct NAS folder.  I was hoping to include a button that would run the upload script for them, rather than requiring that they find and double-click the script that performs the upload.  It would have been nice to have the "upload" button on the single pdf form.  However, I can set up the script in a scheduler and just have it run automatically without requiring user action.  I wanted them to see the upload stats, so they'be be informed of how many documents were getting uploaded.  Anyway, thanks for the quick response and clarification.

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 ,
Feb 01, 2022 Feb 01, 2022

 I don't know what is technically necesssary to upload to your NAS server. I would have thought it would be mounted as a regular file system drive, but if it requires an HTTP operation, then there are three methods that can be run from Acrobat directly. The first is the doc.submitForm() function.  This function perform an ordinary HTTP PUT, with the pdf as the payload.   The next is the Net.HTTP object which can perform a variety of HTTP ops with greater flexibility than the form submit. This object can only be used from Acrobat Professional. The last is the SOAP object, which performs soap operations. It is also limited operation in Professional only.  If none of these options fit the bill exactly, then you could write a small server script to recieve the data from Acrobat and then write the file to the NAS server. 

 

 

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

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
New Here ,
Feb 01, 2022 Feb 01, 2022

Thanks for the suggestions.  I'll do some research and see if any might serve.  Our NAS server is accessed as a regular file system.  This issue is that my users can update their pdf forms remotely when not connected to our office LAN.  When they're in the office and connected, the upload script uploads pdf's they've created since their last upload.  So, it's basically a batch function that they can execute as needed.

thanks again.

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 ,
Feb 02, 2022 Feb 02, 2022
LATEST

One way to make an all in one tool for your process is to create an Acrobat Plug-in.  It's a lot more complicated than the scripting solutions, but provides much greater capabilities. 

https://opensource.adobe.com/dc-acrobat-sdk-docs/acrobatsdk/html2015/index.html#t=Acro12_MasterBook%...

  

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

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 ,
Feb 02, 2022 Feb 02, 2022

Good. If it did I would stop using PDF files, as a bat file can easily delete files on your machine, format your hard-drive, or do countless other types of damage.

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