## Recommended Posts

I have a XML Document that contains Many Records

<Record><DateTime>Mar 17 2006  3:03:00:000PM</DateTime><PointName>OSA</PointName><PointValue>57.38</PointValue></Record>

The Point Name and Point Value Changes, and the time changes. But I want to group the records into groups of points and values with the sametime.

I just want to know if Autoit 3 was well suited for rewritting a xml/text file or should i look for something else. Ive already looked at java script, xslt, some other crap i just need something simple. I think autoit can do it. but i just need to find a sure fire way to do it, and get it done in the next 24 hours cause.. well because my boss likes timelines.

##### Share on other sites

I have a XML Document that contains Many Records

<Record><DateTime>Mar 17 2006  3:03:00:000PM</DateTime><PointName>OSA</PointName><PointValue>57.38</PointValue></Record>

The Point Name and Point Value Changes, and the time changes. But I want to group the records into groups of points and values with the sametime.

I just want to know if Autoit 3 was well suited for rewritting a xml/text file or should i look for something else. Ive already looked at java script, xslt, some other crap i just need something simple. I think autoit can do it. but i just need to find a sure fire way to do it, and get it done in the next 24 hours cause.. well because my boss likes timelines.

i am pretty sure there are some XML udf's in scripts and scraps, i haven't checked them out myself, but they may have functions that will help you. if you could give a slightly larger example of how the data currently looks, and how you'd like it to look afterwards, i can whip something up for you.

##### Share on other sites

i am pretty sure there are some XML udf's in scripts and scraps, i haven't checked them out myself, but they may have functions that will help you. if you could give a slightly larger example of how the data currently looks, and how you'd like it to look afterwards, i can whip something up for you.

attached is the XML in the string that it gets dumped to.

I need to add the xml version code to it.

<?xml version="1.0" encoding="ISO-8859-1"?>

and change the column names to the point names

Example: VAV1 VAV2 VAV3 VAV4 Furnace, OSA

Im looking to display it in a html table.

That looks like this:

DateTime | VAV1 | VAV2 | VAV3 | VAV4 | Furnace | OSA

Mar 17 2006 3:03:00:000PM Value | Value | Value | Value | Value | Value

Mar 17 2006 3:03:00:000PM Value | Value | Value | Value | Value | Value

Mar 17 2006 3:03:00:000PM Value | Value | Value | Value | Value | Value

Mar 17 2006 3:03:00:000PM Value | Value | Value | Value | Value | Value

Mar 17 2006 3:03:00:000PM Value | Value | Value | Value | Value | Value

So i think i need to rewrite each record to be a record of every value at that time.

So:

<Record>
<DateTime>Mar 17 2006  3:03:00:000PM</DateTime>
<PointName>VAV_2</PointName>
<PointValue>25</PointValue>
</Record>
-
<Record>
<DateTime>Mar 17 2006  3:03:00:000PM</DateTime>
<PointName>VAV_3</PointName>
<PointValue>0</PointValue>
</Record>
-
<Record>
<DateTime>Mar 17 2006  3:03:00:000PM</DateTime>
<PointName>Furnace</PointName>
<PointValue>0</PointValue>
</Record>
-
<Record>
<DateTime>Mar 17 2006  3:03:00:000PM</DateTime>
<PointName>VAV_1</PointName>
<PointValue>100</PointValue>
</Record>
-
<Record>
<DateTime>Mar 17 2006  3:03:00:000PM</DateTime>
<PointName>RATemp</PointName>
<PointValue>61.5735</PointValue>
</Record>
-
<Record>
<DateTime>Mar 17 2006  3:03:00:000PM</DateTime>
<PointName>SATemp</PointName>
<PointValue>64.2647</PointValue>
</Record>
-
<Record>
<DateTime>Mar 17 2006  3:03:00:000PM</DateTime>
<PointName>SFProof</PointName>
<PointValue>0</PointValue>
</Record>
-
<Record>
<DateTime>Mar 17 2006  3:03:00:000PM</DateTime>
<PointName>Slider1</PointName>
<PointValue>0.06504</PointValue>
</Record>
-
<Record>
<DateTime>Mar 17 2006  3:03:00:000PM</DateTime>
<PointName>ZTemp1</PointName>
<PointValue>71.1471</PointValue>
</Record>

Would be more like

<Record>

<DateTime>Mar 17 2006 3:03:00:000PM</DateTime>

<PointName>ZTemp1</PointName>

<PointValue>71.1471</PointValue>

<PointName>ZTemp2</PointName>

<PointValue>71.1471</PointValue>

<PointName>ZTemp3</PointName>

<PointValue>71.1471</PointValue>

<PointName>VAV1</PointName>

<PointValue>90</PointValue>

<PointName>VAV2</PointName>

<PointValue>85</PointValue>

</Record>

Sorry if that doesnt make sense, got a noisy customer on the phone.

Thank you for anything you can spare.

au3xmlreport.xml

##### Share on other sites

I worked with RSS Feeds a bit here in this post, maybe the script can give you some ideas: http://www.autoitscript.com/forum/index.ph...ndpost&p=157116

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

##### Share on other sites

I worked with RSS Feeds a bit here in this post, maybe the script can give you some ideas: http://www.autoitscript.com/forum/index.ph...ndpost&p=157116

so is the short answer yes autoit3 would be perfect for this, stop looking and start learning and coding?

some fileopen, read, write and some regex's should do the trick?

##### Share on other sites

You got it!!

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

##### Share on other sites

You got it!!

Thanks

and some other File Functions.

Im trying to evaluate what approach to make on this because my original XMLDoc is one line, basically a single string however long it needs to be to supply the data.

I guess though i could just read the line and parse off the nodes and have it take my file with one line, and write it to another file as proper xml.

So logically i think i know what i need to do. I wouldnt mind some pointers on the general ideas / functions to use and some warnings about files and loops because im sure with a file open, write, in a for..loop there are some major issues that can happen with faulty script.

##### Share on other sites

Ok Question then:

If my file is a single line of text reading:

I am a Line

Would the array end up being:

$aMyArray[1] = I$aMyArray[2] = *space*

$aMyArray[3] = a$aMyArray[4] = m

$aMyArray[5] = *space*$aMyArray[6] = a

$aMyArray[7] = *space*$aMyArray[8] = L

$aMyArray[9] = i$aMyArray[10] = n

$aMyArray[11] = e #### Share this post ##### Link to post ##### Share on other sites Ok so no answer there. so Im trying a few things to see exactly how _FileReadToArray() works Heres my code: #include <File.Au3> Dim$aPreXml
$PostXML= FileOpen("pccreport1.xml", 2) Get_XML() Func Get_XML() If Not _FileReadToArray("pccreport.xml",$aPreXml) Then
MsgBox(4096,"Error", " Error reading log to Array    error:" & @error)
Exit
EndIf
For $x = 1 to 10 step 1 FileWrite($PostXML, $aPreXml[$x])
Next
FileWrite($PostXML, @CR & "ArrayCount = " &$aPreXml[0])
MsgBox(0, "Script Status", "Complete")
EndFunc

Heres my error:

>"C:\Program Files\AutoIt3\SciTE\CompileAU3\CompileAU3.exe" /run /beta /ErrorStdOut /in "C:\Documents and Settings\Scott Corley\Desktop\HTML JS XML\Au3xml\ACCtoPCC_v2.au3" /autoit3dir "C:\Program Files\AutoIt3\beta" /UserParams

>Running AU3Check params: from:C:\Program Files\AutoIt3\SciTE\au3check\

+>AU3Check ended.rc:0

>Running:(3.1.1.18):C:\Program Files\AutoIt3\autoit3.exe "C:\Documents and Settings\Scott Corley\Desktop\HTML JS XML\Au3xml\ACCtoPCC_v2.au3"

C:\Documents and Settings\Scott Corley\Desktop\HTML JS XML\Au3xml\ACCtoPCC_v2.au3 (18) : ==> Array variable has incorrect number of subscripts or subscript dimension range exceeded.:

FileWrite($PostXML,$aPreXml[$x]) FileWrite($PostXML, ^ ERROR

+>AutoIT3.exe ended.rc:0

>Exit code: 0 Time: 0.716

So what am i doing wrong. Im still staring at it to figure this out. im just not exactly sure what the error is saying.

P.S. i really do like this SciTE Editor. First time using it as opposed to notepad.

Thanks in advanced for any help/pointers/tips

## Create an account

Register a new account