Everyone is familar is the Common Dialog - File Open/Save control in Windows, you use it everyday. This script shows you how to script the Common Dialog control and put it to work for you.
Note: This script will run on system's with the Microsoft Controls properly installed. If your machine has virtually any of Microsoft's development tools installed, you probably have these controls. I have yet to find an easy way to distribute these, I am open to suggestions.
// Create the Object
cd = new ActiveXObject("MSComDlg.CommonDialog");
// Set file filter
cd.Filter = "All Files(*.*)|*.*|JScript Files(*.js)|*.js";
cd.FilterIndex = 2;
// Must set MaxFileSize. Otherwise you will get an error
cd.MaxFileSize = 128;
// Show it to user
cd.ShowOpen();
// Retrieve file + path
file = cd.FileName;
// If the user does enter file exit
if ( !file ) {
WScript.Echo("You must enter a file name");
WScript.Quit(0);
} else {
WScript.Echo("The user selected:\n" + file );
}