PC-DMIS CAD++ version 2013MR1
Private Sub CommandButton1_Click() ' Launch PC-Dmis by creating the app object Dim App As Object Set App = CreateObject("PCDLRN.Application") If Not App.WaitUntilReady(300) Then MsgBox "Machine did not initialize, Exiting" Exit Sub End If 'if you get here, the machine initialized successfuly ' Ask the App object for the partprograms object Dim Parts As Object Set Parts = App.PartPrograms App.Visible = True App.SetActive App.Maximize ' Ask the Partprograms object to display the file ' open dialog and return the opened part program object Dim Part As Object ' Set Part = Parts.Open("c:\tmp\lot.prg", "CMM1") Set Part = Parts.Open("c:\tmp\lot.prg", "OFFLINE") App.Visible = True App.SetActive App.Maximize Dim Act_Part As Object Set Act_Part = App.ActivePartProgram Dim Cmds As Object Dim Cmd As Object Set Cmds = Act_Part.Commands Dim lot_number As String lot_number = "0025" For Each Cmd In Cmds MsgBox "did i get here - looking at commands" If Cmd.Type = ASSIGNMENT Then MsgBox "did i get here - found assign command" If Cmd.GetText(DEST_EXPR, 0) = "LOTNUM" Then bln = Cmd.PutText("""" + lot_number + """", SRC_EXPR, 0) Cmd.ReDraw End If End If Next Cmd ' Execute the opened part program 'Part.Execute ' Close the part program 'Part.Close ' Quit the Application (shut down PC-Dmis) 'App.Quit End Sub
Thanks