Basic Script and Common Dialog Procedures

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Basic Script and Common Dialog Procedures

    I am in the process of writing a script which must open a file. I am trying to use the GetOpenFileName procedure from Comdlg32.dll to select the file to open with no success. Has anyone tried this before? I have attached my script which runs properly with the VB script editor in Word but not the script editor in PCDMIS.
    Attached Files

  • #2
    alternative method

    I don't believe BASIC scripting allows you to work with the same common dialog as VB and VBA. It does have similar capabilities though, as shown in this example from the help file (found in the section titled - "Dialog Dialog Function"


    Sub Main ()

    Dim MyList$(2)

    MyList(0) = "Banana"

    MyList(1) = "Orange"

    MyList(2) = "Apple"

    Begin Dialog DialogName1 60, 60, 240, 184, "Test Dialog"

    Text 10, 10, 28, 12, "Name:"

    TextBox 40, 10,50, 12, .joe

    ListBox 102, 10, 108, 16, MyList$(), .MyList1

    ComboBox 42, 30, 108, 42, MyList$(), .Combo1

    DropListBox 42, 76, 108, 36, MyList$(), .DropList1$

    OptionGroup .grp1

    OptionButton 42, 100, 48, 12, "Option&1"

    OptionButton 42, 110, 48, 12, "Option&2"

    OptionGroup .grp2

    OptionButton 42, 136, 48, 12, "Option&3"

    OptionButton 42, 146, 48, 12, "Option&4"

    GroupBox 132, 125, 70, 36, "Group"

    CheckBox 142, 100, 48, 12, "Check&A", .Check1

    CheckBox 142, 110, 48, 12, "Check&B", .Check2

    CheckBox 142, 136, 48, 12, "Check&C", .Check3

    CheckBox 142, 146, 48, 12, "Check&D", .Check4

    CancelButton 42, 168, 40, 12

    OKButton 90, 168, 40, 12

    PushButton 140, 168, 40, 12, "&Push Me 1"

    PushButton 190, 168, 40, 12, "Push &Me 2"

    End Dialog

    Dim Dlg1 As DialogName1

    Dlg1.joe = "Def String"

    Dlg1.MyList1 = 1

    Dlg1.Combo1 = "Kiwi"

    Dlg1.DropList1 = 2

    Dlg1.grp2 = 1

    ' Dialog returns -1 for OK, 0 for Cancel, button # for PushButtons

    button = Dialog( Dlg1 )

    'MsgBox "button: " & button 'uncomment for button return vale

    If button = 0 Then Return

    MsgBox "TextBox: "& Dlg1.joe

    MsgBox "ListBox: " & Dlg1.MyList1

    MsgBox Dlg1.Combo1

    MsgBox Dlg1.DropList1

    MsgBox "grp1: " & Dlg1.grp1

    MsgBox "grp2: " & Dlg1.grp2

    Begin Dialog DialogName2 60, 60, 160, 60, "Test Dialog 2"

    Text 10, 10, 28, 12, "Name:"

    TextBox 42, 10, 108, 12, .fred

    OkButton 42, 44, 40, 12

    End Dialog

    If button = 2 Then

    Dim Dlg2 As DialogName2

    Dialog Dlg2

    MsgBox Dlg2.fred

    ElseIf button = 1 Then

    Dialog Dlg1

    MsgBox Dlg1.Combo1

    End If

    End Sub


    Obviously, this doesn't exactly match your request, but all it takes is a little coding

    Comment

    Related Topics

    Collapse

    Working...
    X