Hi,
OH3.2
I want to read the ink level from my printer and the only way (at least that I am aware of) is to access this data through http binding.
Unfortunately the ink level is not stored in any json or html webpage, where I could use json or xpath transformation profiles, but it is only stored in a javascript file (and there is some magic javascript that will display the ink level dynamically within the UI of the printer).
The output of the JS file is as following and I am wondering what is the best approach to process this data (e.g. should I use some eval function to actually access the variables, better use regex or something else)?
var inktank=[];
var g_cur_tank_num=5;
var inkCOL = ['InkMaz', 'InkBlk', 'InkYel', 'InkPbk', 'InkCia'];
inktank[0]=[0,2,0];
inktank[1]=[1,1,0];
inktank[2]=[2,2,0];
inktank[3]=[3,1,0];
inktank[4]=[4,2,0];
How to read the vars:
The ink tank has 5 cartridges (magenta, black, yellow, pigment black & cyan) and the 2nd value in each inktank object is representing the fill level (magenta = 2, black = 1, yellow = 2, pigment black = 1, cyan = 2).
Thanks in advance for any tips and recommendations on whats the best approach to parse / process these information.