Open the Folder selection dialog
X-Function not designed for Auto GetN Dialog.
1. dlgPath; // path will be saved to path$
2. dlgPath init:="c:\"; // open with c:\ selected
Please refer to the page for additional option switches when accessing the x-function from script
Display Name |
Variable Name |
I/O and Type |
Default Value |
Description |
---|---|---|---|---|
path |
Output string |
|
String to receive folder path. If not specified, path will be saved to path$. | |
title |
Input string |
|
Optional string to display inside dialog. | |
init |
Input string |
|
Optional string to set the starting folder when dialog opens. | |
showfiles |
Input int |
|
Set to 0 to not display files under each folder. Note that dialog does not allow selecting and returning a file path. |
This X-Function opens a dialog for user to select a folder path.
This example first calls dlgPath for user to select a folder path.
Then it calls the findFolders X-function to get all the sub folder names under that path.
It then creates the same sub folder structure in Project Explorer.
dlgPath init:="c:\"; // Let user pick a folder path, start with c:\. The picked path will be put to path$ findFolders; // Find all folders under that path$. Result will be in folder$ if(folder.GetLength() < 1) { type "No subfolders found"; break 1; } int nn = folder.GetNumTokens(CRLF); // Get count of how many subfolders type "$(nn) subfolders found"; string strTemp$; for(int ii = 1; ii <=nn; ii++) { strTemp$ = folder.GetToken(ii, CRLF)$; // get the next sub folder name pe_mkdir strTemp$; // create sub folder in Project Explorer }