Sample Automation Script 2 - Assign an Operator Name to a Variable
The following script receives an operator name from the user and then inserts an COMMENT/OPER command into the Edit window for the currently open measurement routine, displaying the name of the operator.
PC-DMIS must be running with an open measurement routine in the background.
Example Title | Copy Code |
---|---|
Sub Main 'Get operator Name And assign it To variable: N$. N$ = InputBox$("Please enter your name:", "Operator", "", 200, 175) 'The following section adds a comment cmd to the measurement routine Dim App As Object 'Get the pointer to the PC-DMIS application Set App = CreateObject("PCDLRN.Application") Dim Part As Object 'Get the pointer to the current measurement routine Set Part = App.ActivePartProgram Dim Cmds As Object 'Get the pointer to the set of commands In the measurement routine Set Cmds = Part.Commands Dim Cmd As Object 'Add a COMMENT command Set Cmd = Cmds.Add(SET_COMMENT, True) 'Set the comment's type to REPT retvaltype = Cmd.PutText("REPT", COMMENT_TYPE, 0) 'Put the string held in variable N$ into the comment's text retvaltext = Cmd.PutText(N$, COMMENT_FIELD, 1) 'Redraws the COMMENT command so that the applied changes are applied to the measurement routine Cmd.ReDraw End Sub |