Is there a script form of dlgfolder?
By this I mean, is it possible, within a script, to display the normal 'choose folder' dialogue, and them assign the chosen path within the script to a path or string variable?
Is there a script form of dlgfolder?
By this I mean, is it possible, within a script, to display the normal 'choose folder' dialogue, and them assign the chosen path within the script to a path or string variable?
Yes, the Dialog.Folder
method.
Got it! Thanks Jon. It was, in fact, in the obvious place, and I missed it.
All done successfully, except for a minor problem of convenience --- the folder-choosing dialogue does not have focus when it appears. I have to Alt+ Shift+Tab to it.
My code is, with oPath already set as the source directory:
var oDlg = DOpus.dlg
. . . . . . . . [usual] . . . . . . . .
var nChoice = oDlg.show
if (nChoice == 1)
var oPath = oDlg.folder ("Choose", oPath, true)
Changing to scriptCmdData.func.dlg doesn't change this.
Adding a fourth parameter oPath doesn't change it.
Making a separate, independent dialogue with a different variable name for the folder choice doesn't change it.
QUESTION: How do I write the code so that the focus is conveniently on the folder-choosing dialogue when it appears?
You should set the Dialog object's parent window/tab/lister.
If your script is being run via a toolbar button or hotkey, the pre-made Dialog object you are provided via clickData.func is already set up correctly and it's easier to use that instead of creating a new object from scratch.
Done! Thanks Leo.