Finds a command by a unique ID using HighPart and LoPart parameters.
- HiPart
- This parameter is a Long value that should come from a call to GetUniqueID made previously on the desired command object.
- LoPart
- This parameter is a Long value that should come from a call to GetUniqueID made previously on the command object.
Dim App As PCDLRN.Application
' Get the application object via CreateObject
Set App = CreateObject("PCDLRN.Application")
Dim Part As PCDLRN.PartProgram
' Assume measurement routine is already open
Set Part = App.ActivePartProgram
' Get the entire list of commands in the measurement routine
Dim Cmds As PCDLRN.Commands
Set Cmds = Part.Commands
Dim Cmd As PCDLRN.Command
' Declare variables for holding the unique id values
Dim HiPart As Long, LoPart As Long
' Loop through all of the commands in the measurement routine
For Each Cmd In Cmds
' Find the first assignment command in the measurement routine
' And save off the unique id for that command
If Cmd.Type = ASSIGNMENT Then
Cmd.GetUniqueID HiPart, LoPart
Exit For
End If
Next Cmd
' Execute the measurement routine
Part.EXECUTE
Dim ExecutedCmds As PCDLRN.ExecutedCommands
' Obtain the set of execute commands
Set ExecutedCmds = Part.ExecutedCommands
' Check to see if assignment executed
Set Cmd = ExecutedCmds.FindByUniqueID(HiPart, LoPart)
If Not Cmd Is Nothing Then
MsgBox "Assignment command executed"
End If