I would like to execute a handful of script commands in a PCDMIS program from a script (I want to use a button). The following code works one time on a fresh part load. It does not run the script more than once. It does find the script and continue to cycle, just does not actually run any additional calls.
Thanks.
Sub main()
TestIt
End Sub
'=================================
Sub TestIt()
Dim DmisApp As Object
Dim DmisPart As Object
Dim DmisCommands As Object
Dim DmisCommand As Object
Set DmisApp = CreateObject("PCDLRN.Application")
Set DmisPart = DmisApp.ActivePartProgram
Set DmisCommands = DmisPart.Commands
For Each DmisCommand In DmisCommands
If DmisCommand.Type =12346 And DmisCommand.ID = "CS2" Then
MsgBox "yes"
DmisCommand.Execute
DmisCommands.InsertionPointAfter DmisCommand
End If
Next DmisCommand
Set DmisApp = Nothing
Set DmisPart = Nothing
Set DmisCommands = Nothing
Set DmisCommand = Nothing
End Sub