JScript: Pocket PC print with ActiveX

Pocket NiceLabel running on Windows Mobile devices

Moderator: NiceLabel Support Team

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

JScript: Pocket PC print with ActiveX

Post by ivolution » Fri Mar 09, 2007 6:59 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>

primoz
NiceLabel Development
NiceLabel Development
Posts: 22
Joined: Wed Nov 29, 2006 2:10 pm

Post by primoz » Mon Mar 19, 2007 4:31 pm

Try calling SetInputFile before SetVirtualComPort.

nextnicer
Newcomer
Posts: 1
Joined: Tue Jun 09, 2009 4:28 pm
Contact:

Post by nextnicer » Wed Jun 10, 2009 1:10 am

Great example for me, Thanks.

Post Reply