• 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 get FileName path from dialogBox?

Community Beginner ,
Sep 28, 2018 Sep 28, 2018

Copy link to clipboard

Copied

Hi,

How to get FileName path from dialogBox?

I want one dialog box with two question.

First question is:  which file do you want work with? and open button

Second question: enter page range AND here some INPUT FIELD

So I want get string with file path and string with range

TOPICS
Acrobat SDK and JavaScript , Windows

Views

884

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
LEGEND ,
Sep 28, 2018 Sep 28, 2018

Copy link to clipboard

Copied

You probably won't be able to work with files opened from JavaScript, unless they set disclosed. Best to have the user open it, then run your script.

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 Beginner ,
Sep 28, 2018 Sep 28, 2018

Copy link to clipboard

Copied

No i just want have full path to file

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 ,
Sep 28, 2018 Sep 28, 2018

Copy link to clipboard

Copied

You can use the app.browseForDoc() method to prompt the user to select a file. It then returns that file's path, inside of an object.

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

Copy link to clipboard

Copied

Hi

I have error

NotAllowedError: Security settings prevent access to this property or method.

App.browseForDoc:18:Batch undefined:Exec

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

Copy link to clipboard

Copied

Yeah, you can only use this method from a trusted function, ie a script that's installed on the user's local machine, or a certified document.

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

Copy link to clipboard

Copied

So it doesn't help me

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

Copy link to clipboard

Copied

The only other way I can think of is with a text field that's set for file selection, but I'm not sure that will work from a dialog...

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 Beginner ,
Oct 10, 2018 Oct 10, 2018

Copy link to clipboard

Copied

LATEST

I did it in two steps

// dialogBox just for information

app.alert({

cMsg: "select a file",

nIcon: 2

});

//open a window for select a file

// we'll never look at it so size is unimportant

var tmpDoc = app.newDoc(0,0);

// Create the Text Field

var fld = tmpDoc.addField("tmpTxt","text",0,[0,0,0,0]);

// Set up the Text field so the file dialog can be called

fld.fileSelect = true;

// Display File Open Dialog

fld.browseForFileToSubmit();

// save the selected file path to a local variable

// so it can be used later

var path_second_file = fld.value;

// Close Document without saving

tmpDoc.closeDoc(true);

console.println(path_second_file);

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