Page tree
Skip to end of metadata
Go to start of metadata

Introduced in



Description:Creates a common file browser window in VBS3, that can be assigned custom functionality, when a file is selected.


Syntax:[display, buttonCode, buttonText, titleText, defaultPath, fileMask, saveName] call fn_vbs_fileBrowser
  • display: Display - If another dialog is already on the screen, pass the display object here. Otherwise, pass displayNull.
  • buttonCode: Code - Code to run when the OK button is pressed. The selected file and path are passed to the code with the variable _filename. The return value of the code can be a Boolean, in which case, if it returns true, the file browser automatically closes after running the code. Otherwise, the file browser remains open.
  • buttonText: String - Text for the OK button (optional, default: "Load").
  • titleText: String - Text for the title of the file browser window (optional, default: "Select a file").
  • defaultPath: String - Starting folder path and file name to show when the browser is first opened (optional, default: VBS user folder in <Documents>).
  • fileMask: String - Allows a mask to be applied to only show certain files. Same behavior as the fileMask parameter of ListFiles (optional, default: no mask / all files).
  • saveName: String - Allows the user selection to be stored in this parameter, so that subsequent calls with the same saveName restore the last selection. Pass an empty string to always show the defaultPath (optional, default: "").
Return Value:Nothing


When using functions in VBS versions older than 3.4, certain limitations and requirements should be kept in mind - the main ones being that capitalization of the function name is crucial, and that #include "\vbs2\headers\function_library.hpp" has to be included in every script that utilizes it. More Functions A-Z.


[displayNull, {hintC loadFile _filename; true}] call fn_vbs_fileBrowser
[displayNull, {hint ("You selected: " + _filename)}, "Select", "", "", "*.*", "testFileSelection"] call fn_vbs_fileBrowser

Additional Information

See also: fn vbs confirmationDialog
Problems:All folders with a period in the name are seen as files, and cannot be opened.