hexagon logo

Broken Script

Hey all. I hope someone can help me. This won't run Confused

I'm using 4.2 MR3

Sub Main

Begin Dialog DIALOG_1 53,9, 211, 287, "Dialog One", .enable
  OptionGroup .GROUP_1
    OptionButton 16,80,80,12, "1st Piece Sign-Off"
    OptionButton 16,96,80,12, "In-Process Scan"
    OptionButton 16,112,84,12, "Audit"
  GroupBox 4,4,200,280, " "
  TextBox 40,156,32,12, .EditBox_1
  TextBox 40,176,32,12, .EditBox_2
  TextBox 40,196,32,12, .EditBox_3
  TextBox 40,216,32,12, .EditBox_4
  Text 16,140,52,12, "Enter Scan #'s:"
  Text 16,64,72,12, "Enter Scan Type:"
  Text 16,236,180,12, "NOTE: Enter Scan #'s in the station you want to run."
  Text 16,156,24,12, "ST 1:"
  Text 16,176,24,12, "ST 2:"
  Text 16,196,24,12, "ST 3:"
  Text 16,216,24,12, "ST 4:"
  Text 64,20,76,12, "Enter Work Order #:"
  TextBox 64,36,72,12, .EditBox_5
  OKButton 16,260,48,16
  CancelButton 140,260,48,16
End Dialog

Dim app As Object 
Set App = CreateObject("pcdlrn.Application") 

Dim part As Object 
Set Part = App.activePartProgram 

Dim cmds As Object 
Dim cmd As Object 

Dim dlg1 As Menu 
button = Dialog( Dlg1 ) 

Dim sel_text As String 
Dim STATION1 As String 
Dim STATION2 As String 
Dim STATION3 As String 
Dim STATION4 As String 
Dim WORKORDER As String 

If button = 0 Then
    sel_text = "END"
End If

If button = -1 Then 
    Select Case Dlg1.GROUP_1 
        Case 0 
            sel_text = "SIGN-OFF"
        Case 1 
            sel_text = "IN-PROCESS"
        Case 2 
            sel_text = "AUDIT"
    End Select 

    STATION1 = Dlg1.EditBox_1
    STATION2 = Dlg1.EditBox_2
    STATION3 = Dlg1.EditBox_3
    STATION4 = Dlg1.EditBox_4

    WORKORDER = Dlg1.EditBox_5
End If 

Set cmds = part.Commands 
For Each cmd In cmds 

If cmd.TypeDescription = "Assignment" Then 
    If cmd.gettext(dest_expr,0) = "TYPE" Then
        bln = cmd.PutText("""" + sel_text + """", SRC_EXPR, 0)
        cmd.ReDraw
    End If 
    If cmd.gettext(dest_expr,0) = "ST1" Then
        bln = cmd.PutText("""" + STATION1 + """", SRC_EXPR, 0)
        cmd.ReDraw
    End If 
    If cmd.gettext(dest_expr,0) = "ST2" Then
        bln = cmd.PutText("""" + STATION2 + """", SRC_EXPR, 0)
        cmd.ReDraw
    End If 
    If cmd.gettext(dest_expr,0) = "ST3" Then
        bln = cmd.PutText("""" + STATION3+ """", SRC_EXPR, 0)
        cmd.ReDraw
    End If 
    If cmd.gettext(dest_expr,0) = "ST4" Then
        bln = cmd.PutText("""" + STATION4 + """", SRC_EXPR, 0)
        cmd.ReDraw
    End If 
    If cmd.gettext(dest_expr,0) = "WO" Then
        bln = cmd.PutText("""" + WORKORDER+ """", SRC_EXPR, 0)
        cmd.ReDraw
    End If 
End If 

End Sub
Parents
  • Sub Main
    
    ' The following variables must have been assigned In the PC-DMIS partprogram:
    ' Type
    ' ST1
    ' ST2
    ' ST3
    ' ST4
    ' WO
    
    ' Setup the Dialog
    Begin Dialog DIALOG_1 53,9, 211, 287, "Dialog One", .enable
      OptionGroup .GROUP_1
        OptionButton 16,80,80,12, "1st Piece Sign-Off"
        OptionButton 16,96,80,12, "In-Process Scan"
        OptionButton 16,112,84,12, "Audit"
      GroupBox 4,4,200,280, " "
      TextBox 40,156,32,12, .EditBox_1
      TextBox 40,176,32,12, .EditBox_2
      TextBox 40,196,32,12, .EditBox_3
      TextBox 40,216,32,12, .EditBox_4
      Text 16,140,52,12, "Enter Scan #'s:"
      Text 16,64,72,12, "Enter Scan Type:"
      Text 16,236,180,12, "NOTE: Enter Scan #'s in the station you want to run."
      Text 16,156,24,12, "ST 1:"
      Text 16,176,24,12, "ST 2:"
      Text 16,196,24,12, "ST 3:"
      Text 16,216,24,12, "ST 4:"
      Text 64,20,76,12, "Enter Work Order #:"
      TextBox 64,36,72,12, .EditBox_5
      OKButton 16,260,48,16
      CancelButton 140,260,48,16
    End Dialog
    
    Dim Dlg1 As DIALOG_1
    button = Dialog(Dlg1) 
    
    Dim sel_text As String 
    Dim STATION1 As String 
    Dim STATION2 As String 
    Dim STATION3 As String 
    Dim STATION4 As String 
    Dim WORKORDER As String
    
    If button = 0 Then
        sel_text = "END"
    Else
    Select Case Dlg1.GROUP_1 
            Case 0 
                sel_text = "SIGN-OFF"
            Case 1 
                sel_text = "IN-PROCESS"
            Case 2 
                sel_text = "AUDIT"
        End Select
    
    STATION1 = Dlg1.EditBox_1
    STATION2 = Dlg1.EditBox_2
    STATION3 = Dlg1.EditBox_3
    STATION4 = Dlg1.EditBox_4
    WORKORDER = Dlg1.EditBox_5
    End If
    ' Dialog setup End
    
    'Setup PC-DMIS Connection
    Dim App As Object
    Set App = CreateObject("PCDLRN.Application")
    
    Dim Part As Object
    Set Part = App.ActivePartProgram
    
    Dim Cmds As Object
    Dim Cmd As Object
    
    Set Cmds = Part.Commands
    
    For Each Cmd In Cmds
        If Cmd.Type = ASSIGNMENT Then
            If Cmd.GetText(DEST_EXPR, 0) = "TYPE" Then
              bln = Cmd.PutText("""" + sel_text + """", SRC_EXPR, 0)
              Cmd.ReDraw
            End If
            If Cmd.GetText(DEST_EXPR,0) = "ST1" Then
              bln = Cmd.PutText("""" + STATION1 + """", SRC_EXPR, 0)
              Cmd.ReDraw
            End If
            If Cmd.GetText(DEST_EXPR,0) = "ST2" Then
              bln = Cmd.PutText("""" + STATION2 + """", SRC_EXPR, 0)
              Cmd.ReDraw
            End If
            If Cmd.GetText(DEST_EXPR,0) = "ST3" Then
              bln = Cmd.PutText("""" + STATION3 + """", SRC_EXPR, 0)
              Cmd.ReDraw
            End If
            If Cmd.GetText(DEST_EXPR,0) = "ST4" Then
              bln = Cmd.PutText("""" + STATION4 + """", SRC_EXPR, 0)
              Cmd.ReDraw
            End If
            If Cmd.GetText(DEST_EXPR,0) = "WO" Then
              bln = Cmd.PutText("""" + WORKORDER + """", SRC_EXPR, 0)
              Cmd.ReDraw
            End If
        End If
    Next Cmd
    
    End Sub


    Enjoy.
Reply
  • Sub Main
    
    ' The following variables must have been assigned In the PC-DMIS partprogram:
    ' Type
    ' ST1
    ' ST2
    ' ST3
    ' ST4
    ' WO
    
    ' Setup the Dialog
    Begin Dialog DIALOG_1 53,9, 211, 287, "Dialog One", .enable
      OptionGroup .GROUP_1
        OptionButton 16,80,80,12, "1st Piece Sign-Off"
        OptionButton 16,96,80,12, "In-Process Scan"
        OptionButton 16,112,84,12, "Audit"
      GroupBox 4,4,200,280, " "
      TextBox 40,156,32,12, .EditBox_1
      TextBox 40,176,32,12, .EditBox_2
      TextBox 40,196,32,12, .EditBox_3
      TextBox 40,216,32,12, .EditBox_4
      Text 16,140,52,12, "Enter Scan #'s:"
      Text 16,64,72,12, "Enter Scan Type:"
      Text 16,236,180,12, "NOTE: Enter Scan #'s in the station you want to run."
      Text 16,156,24,12, "ST 1:"
      Text 16,176,24,12, "ST 2:"
      Text 16,196,24,12, "ST 3:"
      Text 16,216,24,12, "ST 4:"
      Text 64,20,76,12, "Enter Work Order #:"
      TextBox 64,36,72,12, .EditBox_5
      OKButton 16,260,48,16
      CancelButton 140,260,48,16
    End Dialog
    
    Dim Dlg1 As DIALOG_1
    button = Dialog(Dlg1) 
    
    Dim sel_text As String 
    Dim STATION1 As String 
    Dim STATION2 As String 
    Dim STATION3 As String 
    Dim STATION4 As String 
    Dim WORKORDER As String
    
    If button = 0 Then
        sel_text = "END"
    Else
    Select Case Dlg1.GROUP_1 
            Case 0 
                sel_text = "SIGN-OFF"
            Case 1 
                sel_text = "IN-PROCESS"
            Case 2 
                sel_text = "AUDIT"
        End Select
    
    STATION1 = Dlg1.EditBox_1
    STATION2 = Dlg1.EditBox_2
    STATION3 = Dlg1.EditBox_3
    STATION4 = Dlg1.EditBox_4
    WORKORDER = Dlg1.EditBox_5
    End If
    ' Dialog setup End
    
    'Setup PC-DMIS Connection
    Dim App As Object
    Set App = CreateObject("PCDLRN.Application")
    
    Dim Part As Object
    Set Part = App.ActivePartProgram
    
    Dim Cmds As Object
    Dim Cmd As Object
    
    Set Cmds = Part.Commands
    
    For Each Cmd In Cmds
        If Cmd.Type = ASSIGNMENT Then
            If Cmd.GetText(DEST_EXPR, 0) = "TYPE" Then
              bln = Cmd.PutText("""" + sel_text + """", SRC_EXPR, 0)
              Cmd.ReDraw
            End If
            If Cmd.GetText(DEST_EXPR,0) = "ST1" Then
              bln = Cmd.PutText("""" + STATION1 + """", SRC_EXPR, 0)
              Cmd.ReDraw
            End If
            If Cmd.GetText(DEST_EXPR,0) = "ST2" Then
              bln = Cmd.PutText("""" + STATION2 + """", SRC_EXPR, 0)
              Cmd.ReDraw
            End If
            If Cmd.GetText(DEST_EXPR,0) = "ST3" Then
              bln = Cmd.PutText("""" + STATION3 + """", SRC_EXPR, 0)
              Cmd.ReDraw
            End If
            If Cmd.GetText(DEST_EXPR,0) = "ST4" Then
              bln = Cmd.PutText("""" + STATION4 + """", SRC_EXPR, 0)
              Cmd.ReDraw
            End If
            If Cmd.GetText(DEST_EXPR,0) = "WO" Then
              bln = Cmd.PutText("""" + WORKORDER + """", SRC_EXPR, 0)
              Cmd.ReDraw
            End If
        End If
    Next Cmd
    
    End Sub


    Enjoy.
Children
No Data