POS Printers

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
lcrltd
Junior Coder
Posts: 35
Joined: Thu Nov 16, 2006 8:23 am

POS Printers

Post by lcrltd » Wed Oct 21, 2009 7:19 am

I am trying to create a script to send print to a com port ESC/POS printer.

The VB commands that EPSON say use are

Public Sub cmdPrint()
Dim sPrinter As String

sPrinter = "COM1:" 'local printer

Open sPrinter For Output As #1

Print #1, Chr$(27) & Chr$(64) 'ESC @ = initialize printer
Print #1, "Page 1 - Line1" 'printing lines
Print #1, "Page 1 - Line2"
Print #1, "Page 1 - Line3"
Print #1, "Page 1 - Line4"
Print #1, "Page 1 - Line5"

Print #1, Chr$(12) 'Form feed [FF]: page break (doesnt work!)

Print #1, "Page 2 - Line1"
Print #1, "Page 2 - Line2"
Print #1, "Page 2 - Line3"
Print #1, "Page 2 - Line4"
Print #1, "Page 2 - Line5"

Close #1

End Sub

But MS doesn`t seem to like any of the PRINT lines?

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Wed Oct 21, 2009 8:48 am

That's VB. That's a different language altogether. Macro Scheduler supports Microsoft VBScript. But Microsoft VBScript is not the same as Microsoft VB.

Try this:

Code: Select all

VBSTART
VBEND

VBEval>Chr(27),ch_Esc
VBEval>Chr(12),ch_FormFeed

WriteLn>COM1:,result,%ch_Esc%@
WriteLn>COM1:,result,Page 1 - Line1
WriteLn>COM1:,result,Page 1 - Line2
WriteLn>COM1:,result,Page 1 - Line3
WriteLn>COM1:,result,Page 1 - Line4
WriteLn>COM1:,result,Page 1 - Line5

WriteLn>COM1:,result,ch_FormFeed

WriteLn>COM1:,result,Page 2 - Line1
WriteLn>COM1:,result,Page 2 - Line2
WriteLn>COM1:,result,Page 2 - Line3
WriteLn>COM1:,result,Page 2 - Line4
WriteLn>COM1:,result,Page 2 - Line5
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts