Created
November 29, 2011 21:50
-
-
Save tylerjohnst/1406714 to your computer and use it in GitHub Desktop.
Ugh JScript
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Barcode generation in Windows JScript | |
| number = WSHInputBox('Consignment Barcodes', 'How many barcodes do you want to generate?', '1') | |
| number = parseInt(number) | |
| if number >= 0 | |
| number += 1 | |
| else | |
| return | |
| while number -= 1 | |
| derp = new ActiveXObject('Scriptlet.TypeLib') | |
| uid = derp.Guid.split('-').join('').substring(1,13) | |
| printed = ["! 0 100 175 1", | |
| "BARCODE CODE128A 40 67 20 #{uid}", | |
| "STRING 12X16 40 12 CONSIGNMENT", | |
| "STRING 8X16 20 100 Gray's College", | |
| "STRING 8X16 50 120 Bookstore", | |
| "END"] | |
| fso = new ActiveXObject('Scripting.FileSystemObject') | |
| file = "\\barcode.txt" | |
| text = fso.CreateTextFile(file, 2, true) | |
| for string in printed | |
| text.Write("#{string}\n") | |
| text.Close() | |
| WScript.Sleep(3000) | |
| wsh = new ActiveXObject("WScript.Shell") | |
| wsh.run("copy #{file} lpt1") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?xml version="1.0" encoding="ISO-8859-1"?> | |
| <%- require 'coffee-script' %> | |
| <job id="ParseBarcodes"> | |
| <script language="VBScript"> | |
| <![CDATA[ | |
| Function WSHInputBox(Message, Title, Value) | |
| WSHInputBox = InputBox(Message, Title, Value) | |
| End Function | |
| ]]> | |
| </script> | |
| <script language="JScript"> | |
| <![CDATA[ | |
| <%= CoffeeScript.compile(File.open('barcodes.coffee')) %> | |
| ]]> | |
| </script> | |
| </job> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment