I’m triyng to use the code on the link bellow but it doesn’t work’s.
inductiveautomation.com/forum/v … =70&t=9727
I have a cab PX4L \300 Printer to print Labels.
You can see my code bellow:
#========================================================================================
cab PX4L/300 commands
#========================================================================================
strMessage = “t0/n/r”
#========================================================================================
Import Socket Library
#========================================================================================
import socket
#========================================================================================
Get Printer IP
#========================================================================================
strIP=‘10.11.91.33’
#========================================================================================
Send Data to Printer
#========================================================================================
port=9100
try:
# Open Socket Connection
clientSocket=Socket(strIP,port)
#Open data output stream
outToPrinter=DataOutputStream(clientSocket.getOutputStream())
#Send Data to Printer
outToPrinter.write(strMessage)
#close data stream and socket
outToPrinter.close();
clientSocket.close();
except IOError:
print “Error”
Please, check the message that appears:
Traceback (most recent call last):
File “event:mouseClicked”, line 21, in
File “event:mouseClicked”, line 21, in
NameError: name ‘Socket’ is not defined
Ignition v7.7.4 (b2015033012)
Java: Oracle Corporation 1.8.0_65
I don’t know how can I solve that problem. Could you help me???
Regards,
Leandro