Copy link to clipboard
Copied
If you use this to open a dialog box to select a file:
File.openDialog("Select your XML File", "*.xml")
The how do you open a dialog to select a folder. I would think it would be something like
Folder.openDialog
but alas, it is not, and I cannot find any reference on how to do it anywhere. Does any one know?
Thanks
1 Correct answer
I found it after I posted this. It was answered in this thread
but if you dont want to look there, this is the long and short of it...
it is not opendialog. it is openDlg (how intuitive is that)
var myDefault = new Folder ("U:/xxx/zzz");
var myFiles = myDefault.openDlg(prompt string, filter string+pattern, multi-selection bollean);
Copy link to clipboard
Copied
I found it after I posted this. It was answered in this thread
but if you dont want to look there, this is the long and short of it...
it is not opendialog. it is openDlg (how intuitive is that)
var myDefault = new Folder ("U:/xxx/zzz");
var myFiles = myDefault.openDlg(prompt string, filter string+pattern, multi-selection bollean);
Copy link to clipboard
Copied
I'm confused. That last one does not let you select a folder, it lets you select a file? 'Cause you initially asked
BigGunN wrote:
The how do you open a dialog to select a folder.
To select a folder, you can use either Folder.selectDialog or (folder object).selectDlg. There are a few (pretty vaguely described ) differences, but in general I don't care and use one of these:
// Generic form
f = Folder.selectDialog("wot");
alert (f);
// Pre-selected starting point
folder = new Folder("/usr/bin");
f = folder.selectDlg("wot");
alert (f);
// Pre-defined starting point
folder = Folder.myDocuments;
f = folder.selectDlg("wot");
alert (f);
The full description of the Folder object can be found in the ESTK's Object Model Viewer (it's under Help; then select "Javascript Base Classes" in the ugly help browser that pops up); and also in my version of the same data, available online at http://jongware.mit.edu/idcs5js/pc_Folder.html (which is in the CS5 version, but I don't think something changed in the Base Classes).
Copy link to clipboard
Copied
But I tried the method I posted and it does let me select a folder. I haven't tried your method yet, although I am sure that they work as well since you haven't failed me yet.
But I can verify that what I posted does work in allowing me to select a folder from a dialog.
I actually have your CHM file open already, although I am working on trying to understand the Script UI stuff at the moment.
Thanks,
Copy link to clipboard
Copied
Strange. Possibly the File object gets silently promoted (or demoted) to a Folder through either the regular Object Descendent channels (whatever these may be), or because They made it do so on purpose ...
(Aside: there are couple of pointers for ScriptUI in Adobe's Javascript guide, but you might not know about Peter Kahrel's "ScriptUI for Dummies". It has a far more attractive layout .)
Copy link to clipboard
Copied
Yeah, I was just looking at Peters page before I opened yours. It gave me a lot of good information, but didn't give me an answer to what I was looking for.
Not to hijack my own thread, but maybe you can point me in the right direction regarding a Script UI since I have your ear.
Here is brief rundown of what I would like to do..
1. open a dialog window with two input fields and "browse" buttons, and an OK button
2. when you click the first button next to the first input field, it will open a file dialog window. You select your file and the file string will populate the input field
3. when you click the second button next to the second input field, it opens a folder dialog window. You select the folder and the string populates the second input field.
4. when you click OK, it feeds the values in the input field to a script.
I already have scripts to that open the file and folder dialogs, so the questions are:
1. can a dialog window created with Script UI open up another file dialog window
2. if yes to #1,how do you code a button in a dialog window to call and run a script
If you think this should go in another post, I'll do that.
Copy link to clipboard
Copied
Ah -- I always have a good time wrestling with ScriptUI myself, so no I wouldn't know off-hand how to do that. Did you try a custom 'onClick' handler for your Open File dialog? Peter's guide should contain a sample to show you how.
If you can't get it to work, create a new thread mentioning "ScriptUI" somewhere in the title -- that ought to get Peter's or one of the other ScriptUI wizzes's attention.
Copy link to clipboard
Copied
I will give the onCLick a try, but I feel a new thread in my future.
thanks again.

