Creating a filter for Formtrap Forms Server to modify a barcode passed in from the ERP system.
launch it with
1 | cscript.exe //nologo scriptname.vbs |
Here is the script
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | 'takes print stream and strips batch suffix to leave YDDD ' don't muck around read the entire STDIN in one go input_file = Wscript.StdIn.ReadAll ' get a reference to STDOUT Set objStdOut = WScript.StdOut ' my input streams lines are Unix style so split at new lines \n vbLf input_array = split(input_file, vbLf) array_ubound = ubound (input_array) for i = 0 to array_ubound ' i'm looping through the lines in the input stream ' and chopping out characters 233 and 234 of each line left_input = left(input_array(i), 252) right_input = mid(input_array(i), 255) ' write it back out STDOUT objStdOut.write left_input &amp; right_input ' on the last line don't append a line feed, \n, chr(10) if i <> array_ubound then objStdOut.write vbLf next |
0 Comments