Jump to content

getting xml and parsing..


Recommended Posts

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 by wizzardking
needed to add information, was an incomplete post before
Link to comment
Share on other sites

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..

 

 

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...