Jump to content

Recommended Posts

Posted (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 by wizzardking
needed to add information, was an incomplete post before

Share this post


Link to post
Share on other sites

@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

Thoughts:

  • I will always thank you for the time you spent for me.
    I'm here to ask, and from your response, I'd like to learn.
    By my knowledge, I can help someone else, and "that someone" could help in turn another, and so on.

/*--------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/

ALWAYS GOOD TO READ:

 

Share this post


Link to post
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..

 

 

Share this post


Link to post
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

×
×
  • Create New...