Using Ignition to communicate and control an AX350i Domino inkjet printer

I don't think you can combine multiple queries request as the Domino won't combine the answers into one reply.
I just tried on my side and it's not working either.
By bigger commands, I was thinking about commands to create a label, which combines multiple fields/commands into one query.

I can see you have a valueChanged script on the Message tag.
We were using that before but we switched to direct TCP send/receive to avoid the lag induced by the tags (we had to do that for another brand of printers that had 1 controller for multiple printing heads and that was missing a label sometimes when multiple labels were sent at the same time).
Anyhow, if you want to have a "direct" answer from your printer, you can use that code :

from java.net import Socket, InetSocketAddress ,ConnectException ,SocketTimeoutException
from java.io import BufferedReader, InputStreamReader, PrintWriter
import time
port = 7000
ESC = '1B'.decode('hex')	# Escape
EOT = '04'.decode('hex')	# End Of Transmission
ACK = '06'.decode('hex')	# Positive acknowledge
NAK = '15'.decode('hex')	# Negative acknowledge

def tcpSend(msg ,ip):
	try:
		socket = Socket()
		socket.tcpNoDelay = True
		socket.setSoTimeout(5000)	# timeout for an answer
		socket.connect(InetSocketAddress(ip, port), 2000) # timeout at the socket opening
		
		# input et output streams for the socket
		mes2dev = PrintWriter(socket.getOutputStream(), True)
		dev2mes = BufferedReader(InputStreamReader(socket.getInputStream()))
        
		mes2dev.println(msg)	# Send the message
		reponse = ''
		i = 0
		while not dev2mes.ready() and i < 30:	# Wait for answer
			time.sleep(0.01)
			i += 1
		while dev2mes.ready():	# Retrieve answer
			c = dev2mes.read()
			c_hex = format(c ,'02x').decode('hex')
			if c_hex == EOT:
				break
			elif c_hex == ACK:
				code ,reponse = 200 ,chr(c)
				break
			elif c_hex == NAK:
				code ,reponse = 406 ,chr(c)
				break
			reponse += chr(c)
		socket.close()	# Close the socket
		code ,reponse = 200 ,reponse
	except ConnectException:	# Timeout at socket opening
		code ,reponse = 504 ,None
	except SocketTimeoutException:	# Timeout at answer
		code ,reponse = 504 ,None
	except Exception as e:
		code ,reponse = 400 ,None
	finally:	# Just to be sure we are clean at the end
		try:
			if socket.isConnected():
				dev2mes.close()
				mes2dev.close()
		except:
			pass
		socket.close()
	return code ,reponse

I scraped some code off it but the main part should be here.
Changing to that won't help you with the multi-query command but splitting them won't be that much of an issue with that

tags, w_tags, w_vals = {}, [], []
tags[pathToTagB] = tcpSend(ESC + '1C?' + EOT, printer_ip)[1]
tags[pathToTagC] = tcpSend(ESC + 'y?' + EOT, printer_ip)[1]
for tag, val in tags.iteritems():
	w_tags.append(tag)
	w_vals.append(val)
system.tag.writeBlocking(w_tags, w_vals)
2 Likes