JScript: ActiveX printing

Label printing integration (NiceWatch middleware and ActiveX programming interface)

Moderators: Georges, milos, NiceLabel Support Team

Post Reply
ivolution
Newcomer
Posts: 2
Joined: Fri Mar 09, 2007 6:51 pm

JScript: ActiveX printing

Post by ivolution » Mon Mar 12, 2007 4:28 pm

I am trying to create JScript that will print from Pocket PC (Windows CE 5) to Zebra QL220. But i cannot make it work, i get different erros 1709, 1724.

Anyone with experience to give me advice, if the code is wrong or maybe i am missing some setting on the PocketPC.

Thanks in advance, here is teh code:

Code: Select all

<script type="text/JScript">
function test() {
	PocketNice = new ActiveXObject("PocketNicePrint.Engine.1") ;
	tmp = PocketNice.Init(0);
	alert("Init - "+tmp);

	tmp = PocketNice.SetVirtualComPort(4);
	if (tmp != 0) {
		errorStr = new String("asd");
		PocketNice.GetLastError(tmp, errorStr, 255);
		alert("Error: @"+errorStr+"@");
	}
	alert("SetVirtualComPort - "+tmp);

	tmp = PocketNice.SetInputFile( 0, "\My Documents\personal", "label.pnl" ) ;
	if (tmp != 0) {
		var errorStr = "";
		error = PocketNice.GetLastError(tmp, errorStr, 255);
		alert("Error: "+errorStr);
	}	
	alert("SetInputFile - " + tmp) ;
	
	tmp = PocketNice.StartPrint();
	if (tmp != 0) {
		var errorStr = "";
		error = PocketNice.GetLastError(tmp, errorStr, 255);
		alert("Error: "+errorStr);
	}	
	alert("StartPrint - "+tmp);

	tmp = PocketNice.Print(1);
	if (tmp != 0) {
		var errorStr = "";
		error = PocketNice.GetLastError(tmp, errorStr, 255);
		alert("Error: "+errorStr);
	}	
	alert("Print - "+tmp);	
	
	tmp = PocketNice.EndPrint();
	if (tmp != 0) {
		var errorStr = "";
		error = PocketNice.GetLastError(tmp, errorStr, 255);
		alert("Error: "+errorStr);
	}
	alert("EndPrint - "+tmp);	
}	
</script>
<a href=# onclick="return test();" >TEST</a>

User avatar
jurk
Addict
Addict
Posts: 175
Joined: Wed Sep 27, 2006 1:10 pm
Location: Sencur, Slovenija
Contact:

Post by jurk » Fri Mar 30, 2007 11:33 am

Error 1709 means that there is a problem while sending data to COM/BT port. For this you will have to verify that your printer works properly.

Error 1724 means that you are calling functions in invalid order. Please reffer to our documentaion. It says there what the correct function calling flow is. My guess is that you first need to SetInputFile and then call SetVirtualComPort.

Hope this helps 8)
NiceLabel Development

Post Reply