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

How to script opening a folder to select an unnamed FDF from among several FDF files

Engaged ,
Nov 07, 2017 Nov 07, 2017

Copy link to clipboard

Copied

I would like to find a means to cause a script in DocA to open a specified folder, after which the user would select one of many fdf files in that folder to import into DocA. (The file name is not known when creating the script.)

When I execute the following script in a mouse up action I receive a privileged status warning asking if I trust this site, but when I click "Allow" nothing happens, and placing this in a privileged folder level script does not seem to work either.

var parentPath = this.getField("txtL.Path.Parent").valueAsString;

var agentFolder = this.getField("txtL.Folder.Agent").valueAsString;

     this.importAnFDF("" + parentPath + agentFolder);

Can I do what I want to do? If so, how?

TOPICS
Acrobat SDK and JavaScript , Windows

Views

642

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 , Nov 07, 2017 Nov 07, 2017

It's not possible. You can either specify the entire file-path, or nothing.

If you do the latter you can't control to which folder it will default to.

On Tue, Nov 7, 2017 at 10:38 PM, ddunn@davidsdunn.com <

Votes

Translate

Translate
Community Expert ,
Nov 07, 2017 Nov 07, 2017

Copy link to clipboard

Copied

If you want the user to select a file themselves, you won't be able to specify the default folder the file chooser dialog is set to. However, it will be "sticky" once chosen.

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
Engaged ,
Nov 07, 2017 Nov 07, 2017

Copy link to clipboard

Copied

Thank you. That works fairly well, but It would be nice if I could do what I wanted.

David

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 ,
Nov 07, 2017 Nov 07, 2017

Copy link to clipboard

Copied

It's not possible. You can either specify the entire file-path, or nothing.

If you do the latter you can't control to which folder it will default to.

On Tue, Nov 7, 2017 at 10:38 PM, ddunn@davidsdunn.com <

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
Engaged ,
Nov 07, 2017 Nov 07, 2017

Copy link to clipboard

Copied

Affirmative. Thank you.

David

How to script opening a folder to select an unnamed FDF from among several FDF files

created by try67<https://forums.adobe.com/people/try67> in JavaScript - View the full discussion<https://forums.adobe.com/message/9953005#9953005>

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
Engaged ,
Nov 19, 2017 Nov 19, 2017

Copy link to clipboard

Copied

This is a follow up question to my original question above.

Is there a security reason for not permitting importAnFDF( ) to open a specific folder to allow the user to import an fdf file of the user's choice? This would be a great convenience. If there is no security rationale for not providing this functionality, how do I submit it as a constructive suggestion?


Even it there is a security concern, it seems to me that it ought to be made possible in a privileged context.

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 ,
Nov 19, 2017 Nov 19, 2017

Copy link to clipboard

Copied

LATEST

Yes, this is a security thing. Scripts, especially scripts in  a document cannot be trusted. So access to the file system is heavily restricted. Part of this from early on was not providing robust functionality for functions that do access the file system. If you know the exact location of a file, you can access it with Acrobat JS, but specifying a folder is too much like fishing the system.  The security issue has only gotten worse, so there was never any incentive to improve file system access.

That said, there is a way to do what you want to do. Which is to perform the folder access from an external VB app (assuming your on windows), and then load the FDF with either the IAC, or JS through the IAC.  In this case the UI for opening the FDF is started and run outside of Acrobat. But the FDF load and displaying the loaded file still happen in Acrobat.

Here's a link to the IAC docs

Acrobat DC SDK Documentation

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

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