I have been researching on how to read a xml input file into a batch file to read compare the data, but not had much luck.
This data will need then to be stored as a variable so we can compare the values.
There are a total of 4 values we need to measure, these are, temperature, ph, nh3 and o2
Because these values can change every hour when the data is pulled we need a way of comparing the data with a set value such as:
IF ph=7.8 GOTO PHHIGH ELSE OK
Is this possible?
Many thanks to all who responds.
I have included the xml file below:
This works with the data you have now posted.
@echo off for %%a in (temperature ph nh3 o2) do ( for /f "tokens=2 delims=</>" %%b in ('type "[Megafileupload]Seneye_Reading.xml" ^|findrepl "(<.*?>.*?</.*?>)" "$1\r\n" ^|findrepl "><" ">\r\n<" ^|findrepl ".*<%%a>.*" /e:".*</%%a>.*" /b:".*<curr>" ') do set "123-%%a=%%b" ) set 123 pause
This uses a helper batch file called
findrepl.bat (by aacini) - download from: https://www.dropbox.com/s/rfdldmcb6vwi9xc/findrepl.bat
findrepl.bat in the same folder as the batch file or on the path.