hexagon logo

Code for implementation of Barcode Scanning into Tracefields

Hello All, 

I hope this is helpful to someone. I've tried searching for a way to streamline inputting information into Tracefields and comment boxes, but never found a good way to do it. After buying the automation package for Inspect, which allowed for use of barcode scanner to open specific programs, I decided to experiment and expand what we could use the barcode scanner for. I found that windows will take the input from a barcode reader and paste the information as text with no need for additional software. I have tested this in most MS Office apps and of course in PC-Dmis as well. You can use a barcode scanner to input the information directly into comments and into tracefields as well. Here is the code I have written with some logic gates to prevent the wrong barcode from being scanned and the information being input incorrectly.

C6 =COMMENT/INPUT,NO,FULL SCREEN=NO,
Please scan badge
ASSIGN/V9=C6.INPUT
IF/V9<1
COMMENT/OPER,NO,FULL SCREEN=NO,AUTO-CONTINUE=NO,OVC=NO,
INVALID INPUT , PLEASE RESCAN Badge Number
GOTO/C6
END_IF/
IF/V9>9999
COMMENT/OPER,NO,FULL SCREEN=NO,AUTO-CONTINUE=NO,OVC=NO,
INVALID INPUT , PLEASE RESCAN Badge Number
GOTO/C6
END_IF/
C7 =COMMENT/INPUT,NO,FULL SCREEN=NO,
Please scan Job Number
ASSIGN/V10=C7.INPUT
TRACEFIELD/DISPLAY=YES,REPORT=NO,DISPLAY MESSAGE=CMM Operator # ; CMM Operator : V9
TRACEFIELD/DISPLAY=YES,REPORT=NO,DISPLAY MESSAGE=Job number ; Job number : V10
IF/LEN(V10)<>6
COMMENT/OPER,NO,FULL SCREEN=NO,AUTO-CONTINUE=NO,OVC=NO,
INVALID INPUT , PLEASE REINPUT Job Number
GOTO/C7
END_IF/
ASSIGN/V12=FORMAT("%i",INT(V10))
IF/LEN(V12)<>6
COMMENT/OPER,NO,FULL SCREEN=NO,AUTO-CONTINUE=NO,OVC=NO,
INVALID INPUT , PLEASE REINPUT Job Number
GOTO/C7
END_IF/

I wrote this code a few months ago and always meant to share but got busy and forgot. In the example our badge numbers are integers only between 1 and 9999 and our job numbers are 6-digit integers without letters or other characters. The code can be modified to include letters provided your job numbering follows a specific layout or pattern. I have tested this for a while but any feedback or improvements to the code are welcome, I am sure that it can be streamlined some. If you would like to test you will need a USB barcode scanner which can be purchased on amazon for fairly cheap and does not require anything else.