none
Common File Dialog replacement for W7

    Question

  • Hi
    I have used the following excerpt of a script to display a file select
    box with XP and copy the selected file as part of a larger script.
    On W7, this does not work anymore. I searched the web and found that I
    am not the only one having this issue. However, I could not find a
    solution that works so far.

    With some assistance in the SBS forum we found that the CommonDialogs are no longer available starting from Vista.

    Any suggestions how to modify this script that it runs on W7 (and XP ideally)?
     
    ' If OK has been selected, we show a file dialog to select a file and copy the file
    Set objDialog = CreateObject("UserAccounts.CommonDialog")
    objDialog.Filter = "Eagle BOM|*.txt|All Files|*.*"
    objDialog.FilterIndex = 1
    objDialog.InitialDir = SourcePath
    Set oFS = CreateObject("Scripting.FileSystemObject")
    intResult = objDialog.ShowOpen
    If intResult = 0 Then
        Wscript.Quit
    Else
        Set oFile = oFS.GetFile(objDialog.FileName)
        oFile.Copy (TargetPath & "CADimport.txt")
        prompt = "BOM  " + oFile + "  wurde kopiert und bereitgestellt"
        intResult = MsgBox(prompt, 64, title)
    End If
     
    Thanks a lot
    Franz
     

    Monday, June 20, 2011 12:47 PM

Answers

All replies