P.D.: the code works on excel.
Code: Select all
Sub Botón1_Haga_clic_en()
Open "\\ASUSTEK-PC\EPSON TM-T20II Receipt" For Output As #1
Print #1, Chr(27) & Chr(112) & Chr(0) & Chr(25) & Chr(250)
Close #1
End Sub
Moderator: Neosoft Support
Code: Select all
Sub Botón1_Haga_clic_en()
Open "\\ASUSTEK-PC\EPSON TM-T20II Receipt" For Output As #1
Print #1, Chr(27) & Chr(112) & Chr(0) & Chr(25) & Chr(250)
Close #1
End Sub
Code: Select all
Sub Botón1_Haga_clic_en()
Open "\\ASUSTEK-PC\EPSON TM-T20II Receipt" For Output As #1
Print #1, Chr(27) & Chr(112) & Chr(0) & Chr(25) & Chr(250)
Close #1
End Sub
Botón1_Haga_clic_en()
You might try and Run the commands in a VBScript file e.g. ...is there a way to adapt the code to work properly in neobook?
P.D.: the code works on excel.
Code: Select all
Run "![PubDir]myTest.vbs" "" "Normal" "" ""
I don't have the hardware to verify if this will work, so I just did a test with myTest.vbs (in the [PubDir] like so ...btw the code is for kicking the cash drawer connected to a pos printer.
Code: Select all
WScript.Echo "Hello from my test vbs file"
WScript.Echo "Ended my test vbs file"
Code: Select all
WScript.Echo "Hello from my test vbs file"
Open "\\ASUSTEK-PC\EPSON TM-T20II Receipt" For Output As #1
Print #1, Chr(27) & Chr(112) & Chr(0) & Chr(25) & Chr(250)
Close #1
WScript.Echo "Ended my test vbs file"
a) I am assuning that this code in myTest.vbs worked ...but none of the posible solutions are working, it simple says the same error,
"ErrorCode 800a0401"
"expected end of statement"
at line 2, character 45
Code: Select all
WScript.Echo "Hello from my test vbs file"
WScript.Echo "Ended my test vbs file"
Code: Select all
WScript.Echo "Hello from my test vbs file"
Open "\\ASUSTEK-PC\EPSON TM-T20II Receipt" For Output As #1
Close #1
WScript.Echo "Ended my test vbs file"
Code: Select all
WScript.Echo "Hello from my test vbs file"
Open "\\ASUSTEK-PC\EPSON TM-T20II Receipt" For Output As #1
Print #1, "1234"
Close #1
WScript.Echo "Ended my test vbs file"
I read in one of the vbscript forums that such scripts only print to the DEFAULT printer ... so it could be that the error message it puts out is somewhat misleading (not the first time Microsoft has been accused of this).the 2 dialog boxes are shown correctly no errors, but if i add any of the other lines (open or print) it simply shows the same error as described before.
Code: Select all
WScript.Echo "Hello from my test vbs file"
Open "\\ASUSTEK-PC\EPSON TM-T20II Receipt" For Output As #1
Print #1, "Hello Amigo"
Close #1
WScript.Echo "Ended my test vbs file"
Code: Select all
WScript.Echo "Hello from my test vbs file"
Set FSO = CreateObject("Scripting.FileSystemObject")
Set objPrinter = FSO.CreateTextFile("\\ASUSTEK-PC\EPSON TM-T20II Receipt", True)
objPrinter.Write("This is a test ---")
objPrinter.WriteLine("This is a new line")
objPrinter.Close
WScript.Echo "Ended my test vbs file"
Code: Select all
Set FSO = CreateObject("Scripting.FileSystemObject")
Set objPrinter = FSO.CreateTextFile("\\ASUSTEK-PC\EPSON TM-T20II Receipt", True)
objPrinter.Write("This is a test ---")
objPrinter.WriteLine("This is a new line")
objPrinter.Write Chr(27) & "m" & Chr(109) ' partial cut code
objPrinter.Write Chr(27) & "p" & CHR(&H0) & CHR(&H64) & CHR(&H64)' open cash drawer code
objPrinter.Close
Glad to hear that; so it looks like the problem with the other code was that it does not allow printing to a NON-DEFAULT printer.the last posted code works flawlessly!
Note that you do not need these two lines ...now i cand send any esc/pos code to the POS printer.
Here is the same code with the cut and open cash drawer commands.
Code: Select all
objPrinter.Write("This is a test ---")
objPrinter.WriteLine("This is a new line")
I am not sure ... since your printer is being treated as a "file", it might be complicated to "read" a particular line/row/byte that constitutes the status code ... but before I investigate this, according to the Quick Reference Guide for this printer, there are two ways to ask for the "drawer status information' ...is there a way to receive data from the printer, to monitor the cash drawer status? (open/close)
Code: Select all
DLE EOT 1 'transmits real time status
GS r 1 'transmits status after completion of prior print or command
Code: Select all
Set FSO = CreateObject("Scripting.FileSystemObject")
Set objPrinter = FSO.CreateTextFile("\\ASUSTEK-PC\EPSON TM-T20II Receipt", True)
Set drawerStatus = objPrinter.Write("This is a test ---" & Chr(29) & "r2"
WScript.Echo "Drawer Status is " & drawerStatus
objPrinter.Close