wizzardking Posted May 4, 2019 Posted May 4, 2019 (edited) I am working on converting a powershell script to autoit... Here's what I have to do: Retrieve xml code from a web based api and retrieve certain data from the HUGE xml file... my powershell code $xmlurl = "http://127.0.0.1:8088/API/" $data = (New-Object System.Net.WebClient).DownloadString($xmlurl) $node = $data.SelectNodes("/vmix/inputs/input[@state='Running']") $title = ($node | Select-Object -ExpandProperty title | Out-String) $dura = ($node | Select-Object -ExpandProperty duration | Out-String) $position = ($node | Select-Object -ExpandProperty position | Out-String) Is there an easy way to do this in autoit or do I have to find a way to get the url into a text file and manually parse it out?? The reason I am turning to autoit is that this script has to run 24/7 - and powershell becomes memory hoggish and processor hoggish after a few hours, currently I am having it launch itself and then terminate the original, and that works for a few days... I used autoit years ago to write scripts that looked for certain print files jobs on print servers and then rerouted them to non busy printers for large law firms, those scripts still run today (10+ years later) and autoit packages the script into a nice exe file... I am an old hat, but havn't edited in about 5 years so rusty as hell.. Edited May 4, 2019 by wizzardking needed to add information, was an incomplete post before
FrancescoDiMuro Posted May 4, 2019 Posted May 4, 2019 @wizzardking There are plenty UDFs to work with XML files; one the most famous is probably XML UDF. Take a look at it and at the support topic attached in the link Click here to see my signature: Spoiler ALWAYS GOOD TO READ: Forum Rules Forum Etiquette
wizzardking Posted May 6, 2019 Author Posted May 6, 2019 Ok, I got the udf... I guess the next task (actually the first) is how to get the xml file from the webserver into autoit... in powershell I sinply do: $data = (New-Object System.Net.WebClient).DownloadString($xmlurl) and that places the xml file into the array $data... Then $node = $data.SelectNodes("/vmix/inputs/input[@state='Running']") makes array $node = the xml input that is active.. and so forth which I can now figure out by using the xml udf above.. But getting the xml into $data when it's on a live webserver as opposed to a simple file.. That is where I am stuck.. I tried playing with the internal browser and I can view the xml with it..
mikell Posted May 6, 2019 Posted May 6, 2019 You might try something like this $xml = BinaryToString(InetRead($xmlurl)) Local $oXML = ObjCreate("Microsoft.XMLDOM") $oXML.loadxml($xml) $node = $oXML.SelectNodes("/vmix/inputs/input[@state='Running']") ; etc
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now