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

ChooseFile not working to open a directory ?

Advocate ,
Aug 15, 2014 Aug 15, 2014

Copy link to clipboard

Copied

Hi all,

I am creating an installer for my scripts and need to get an istall directory from the customer. It seems that ChooseFile ( ) with the ChooseOpenDir parameter is exactly what I need. But this does not work: there is no dialog and the return value is always null. Does anyone else experience this? Is this a bug in FM or just something wrong in my FM installation? I am running FM 12.0.0.308 on Windows 7.

Ciao

Jang

TOPICS
Scripting

Views

590

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 ,
Aug 15, 2014 Aug 15, 2014

Copy link to clipboard

Copied

Hi Jang,

Post your code and I will try it here. Or, you could ExtendScript's built-in Folder methods:

var folder = Folder(app.OpenDir).selectDlg ("Select a folder:");

or

var folder = Folder.selectDialog ("Select a folder:");

The major difference is that selectDlg lets you start with a default folder selected.

Rick

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 ,
Aug 15, 2014 Aug 15, 2014

Copy link to clipboard

Copied

Jang,

I always use openDlg function of Folder class. This works well for my use cases.

I think I discovered the same issue former times and decided to use Folder class.

Hope this helps

Markus

BTW: I wrote and extend script installer some time ago. practice innovation | SWATFMINSTALLSCRIPTS

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
Mentor ,
Aug 15, 2014 Aug 15, 2014

Copy link to clipboard

Copied

LATEST

Hi Jang,

It works for me, something like this:

var path = ChooseFile("Browse for folder", "", "", Constants.FV_ChooseOpenDir);

alert(path);

One thing though... there is a bug in the interface where the prompt will fail and just return null if the start path is bogus:

var path = ChooseFile("Browse for folder", "C:\\Some\\Bogus\\Path", "", Constants.FV_ChooseOpenDir);

Make sure that the path is a valid folder, if you are specifying one. It might even give you problems if the path points to a file, even if valid.

Russ

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