AskDirectory

Displays a directory browse dialog box, and returns the selected directory name.

Syntax:

AskDirectory(prompt, browse-root, start-dir, confirm-prompt, flags)

Parameters:

(s) prompt: Prompt to be displayed in the dialog box above the list of directories. This can be a blank string ("") if no prompt is desired. Note that the title of the dialog box ("Browse for Folder") cannot be changed.

(s) browse-root: Directory under which the user can browse for directories. The user will not be able to browse above this level. You can specify a blank string ("") to allow the entire file system (all drives, directories, and network shares) to be browsed.

(s) start-dir: Directory which will be selected by default when the dialog box is initially displayed. This can be a blank string (""), in which case the top of the tree will be selected (same as 'browse-root').

(s) confirm-prompt: The title of the confirmation message box (see 'flags' #2, below).

(i) flags: One or more of the optional flags (see below), combined using the binary OR ("|") operator, or 0 if none are desired.

Returns:

(s) string: The string containing the directory path selected in the browse dialog. If the user presses "Cancel", standard WIL ":cancel" processing will be performed

 

Flags

Meaning

0

None of the following apply.

 

1

Display an edit field in the dialog box, in which the user can type the name of a directory which may or may not exist. This name will be relative to the currently selected directory name in the browse list.

 

2

If the user types a name in the edit field (see flag #1), of a directory which does not exist, this flag causes a confirmation message box to be displayed, showing the name of the directory that would be returned by the function, and containing three buttons: Yes, No, and Cancel.

If the user selects 'Yes', the function returns. If the user selects 'No', the directory browse dialog remains displayed, and the user can re-edit the name or select a different directory. 'Cancel' causes the function to return, and standard WIL ":cancel" processing to be performed.

 

4

Use the new user interface. Setting this flag provides the user with a larger dialog box that can be resized. The dialog box has several new capabilities including: drag and drop capability within the dialog box, shortcut menus, new folders, delete, and other shortcut menu commands.

 

8

Do not include the "New Folder" button in the browse dialog box.

NOTE: This is supported only in Windows XP or newer. In older versions of Windows, this flag is ignored.

 

16

Suppress "Drive not ready" errors.

 

32

Makes directory browse dialog an owned window.

 

 

Example:

flags=1|2
dir1=AskDirectory("Select Working Directory for Winbatch", "C:\Program Files\WinBatch", "","Are you sure?",flags)
Message("Directory Path selected was", dir1)

which produces:

askdir_shg.gif

and then:

askdir_m_shg.gif
See Also:

AskFileName, AskLine, DirItemize, AskItemList