Save a File Using a File Save Dialog Box

Demonstration script that allows you to enter a file name in a File Save dialog box, and then saves a sample text file (consisting entirely of the current date) under that file na

Add to favorites
E-mail Twitter Digg Facebook
  • How can you open a similar dialog box with Windows 7 ?
    2 Posts | Last post May 08, 2012
    • I have been searching high and low for a script that performs a similar task as the "Save a File Using a File Save Dialog Box" but for Windows 7. Is there no easy way to achieve the same result?
    • Hi,
         Microsoft changed the library for "CommonDialog" in Vista and superior versions. Use the script for all windows versions:
         ' Get Windows Version.
         Set oWMIqry = GetObject("winmgmts:").InstancesOf("Win32_OperatingSystem")   
         For Each oWMIObj In oWMIqry
            vArray = Split(oWMIObj.Version, ".")
         ' Create a dialog object for current version.
         If vArray(0) < "6" Then
            Set oDialog = CreateObject("UserAccounts.CommonDialog")
            oDialog.InitialDir = CreateObject("WScript.Shell").SpecialFolders("MyDocuments")
            Set oDialog = CreateObject("MSComDlg.CommonDialog")
            oDialog.InitDir = CreateObject("WScript.Shell").SpecialFolders("MyDocuments")
         End If