Ethernet POS Documentation - VBScript sample

Notes

This code opens the Ethernet POS listening named pipe as a text file, and writes a confirmation ticket to the opened named pipe file. It uses ESC/POS Epson® commands to initialize the printer and perform a paper cut.

To test this code, create a file with the .vbs extention, copy this code inside the created file, and execute the code by double clicking it.

Code Dim oFSO, oFile

' Create file object and open Ethernet POS named pipe
Set oFSO = CreateObject("Scripting.FileSystemObject")
Set oFile = oFSO.CreateTextFile("\\.\pipe\ethpos_printer_0", True)

' Initialize printer
oFile.Write Chr(27) & "@"

' Align center
oFile.Write Chr(27) & "a" & Chr(1)

' Write header as straight text
oFile.Write "Active+ Software" & vbCrLf
oFile.Write "https://www.activeplus.com" & vbCrLf & vbCrLf

' Align left
oFile.Write Chr(27) & "a" & Chr(0)

' Write order details as straight text
oFile.Write "Order details:" & vbCrLf & vbCrLf
oFile.Write "2 x Ethernet POS (1 machine)       $98.00" & vbCrLf
oFile.Write "1 x Ethernet POS (5 machines)     $239.00" & vbCrLf
oFile.Write "-----------------------------------------" & vbCrLf
oFile.Write "Total:                            $337.00" & vbCrLf

' Cut paper
oFile.Write Chr(29) & "V" & Chr(65) & Chr(3)

' Cleanup
oFile.Close
Set oFile = Nothing
Set oFSO = Nothing

Download ethpos.vbs