Folder selection box - How to bring it up using Javasript

Explorer ,
Oct 01, 2018 Oct 01, 2018

Copy link to clipboard

Copied

Not looking for app.browseForDoc() function.  This one only gets the files.  I am looking for a way to bring up the Folder selection box so a user can select the folder location where a list of files are kept and then have a simple script to loop through the folder selected and combine them into one document. 

Does anyone know how to do this?

TOPICS
Acrobat SDK and JavaScript, Windows

Views

189

Likes

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
Adobe Community Professional ,
Oct 01, 2018 Oct 01, 2018

Copy link to clipboard

Copied

Acrobat JS doesn't have that capability. The only way you can get a list of files in Acrobat is if you run an Action over the folder.

Likes

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
Explorer ,
Oct 01, 2018 Oct 01, 2018

Copy link to clipboard

Copied

I know that the Action has a Folder selection object and then you can run a javascript right after.  How do you capture what folder option the user selected?

Likes

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
Adobe Community Professional ,
Oct 01, 2018 Oct 01, 2018

Copy link to clipboard

Copied

You can't. But you can capture the paths of the files it is processing.

Likes

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
Explorer ,
Oct 01, 2018 Oct 01, 2018

Copy link to clipboard

Copied

This seems to be what I am lookin for:

***********************************************************************************************************************************************************The folder object is defined in the Extendscript DOM and hence can only be used in a jsx file but not in the JS file of the extension. You will have to write your code so that the JS calls the methods of InDesign or Extendscript DOM by calling methods in the jsx file. A basic example would be as follows

in extension js

var csi = new CSInterface()

csi.evalScript('callSelectFolderInJSX()', function(data){

alert("This is the callback that is called once the method of JSX is finished execution. data is the value returned from jsx code)

})

in extension jsx

function callSelectFolderInJSX()

{

     var folder = Folder.selectDialog()

     return folder.fsName.toString()

}

Demonstrated above is a basic framework of communication between js and jsx of extension so that we can have a bridge between the HTML DOM and InDesign/Extendscript DOM.

Hope this helps

-Manan

******************************************************************************************************************************************************

How do you call the jsx file from js? 

Likes

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
Adobe Community Professional ,
Oct 01, 2018 Oct 01, 2018

Copy link to clipboard

Copied

You can't. This code was not written for Acrobat and will not work in it.

Likes

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
Explorer ,
Oct 01, 2018 Oct 01, 2018

Copy link to clipboard

Copied

You can't. But you can capture the paths of the files it is processing.- so how do you do this?

Likes

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
Adobe Community Professional ,
Oct 01, 2018 Oct 01, 2018

Copy link to clipboard

Copied

Run the Action on the files and then you would be able to access the path of each one using the path property of the Document object. You can save those paths into a global variable and access them later on.

Likes

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
Explorer ,
Oct 01, 2018 Oct 01, 2018

Copy link to clipboard

Copied

Can you give an example?

Likes

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
Adobe Community Professional ,
Oct 01, 2018 Oct 01, 2018

Copy link to clipboard

Copied

LATEST

I suggest you read the Acrobat JavaScript API Reference about the property I mentioned and the global object, and how to use them.

Likes

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