Firefoxy Posted May 17, 2008 Posted May 17, 2008 expandcollapse popup#include<Array.au3> #include<GUIConstantsEx.au3> #include <File.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", 550, 230, 194, 134) $List1 = GUICtrlCreateListView("Price|Item", 8, 32, 161, 158) $List2 = GUICtrlCreateListView("Price|Item", 184, 32, 169, 158) $List3 = GUICtrlCreateListView("Price|Item", 368, 32, 169, 158) $Button1 = GUICtrlCreateButton("Review and Order", 416, 200, 123, 25) $oXml = ObjCreate("Msxml2.DOMDocument") $oXml.Load("C:\Menu.xml") $text = "" $oNodeList = $oXml.documentElement.selectNodes("//menu/food") $c = 0 $file_app = FileOpen("C:\Appetizer.txt", 1) $file_ent = FileOpen("C:\Entree.txt", 1) $file_des = FileOpen("C:\Dessert.txt", 1) For $oNode In $oNodeList If $oNode.childNodes(2).FirstChild.Text = "Appetizer" Then FileWrite($file_app, $oNode.childNodes(1).FirstChild.Text & "|" & $oNode.childNodes(0).FirstChild.Text & @CRLF) ElseIf $oNode.childNodes(2).FirstChild.Text = "Desert" Then FileWrite($file_des, $oNode.childNodes(1).FirstChild.Text & "|" & $oNode.childNodes(0).FirstChild.Text & @CRLF) ElseIf $oNode.childNodes(2).FirstChild.Text = "Entree" Then FileWrite($file_ent, $oNode.childNodes(1).FirstChild.Text & "|" & $oNode.childNodes(0).FirstChild.Text & @CRLF) EndIf Next FileClose($file_app) FileClose($file_ent) FileClose($file_des) $file_app1 = FileOpen("C:\Appetizer.txt", 0) $file_ent1 = FileOpen("C:\Entree.txt", 0) $file_des1 = FileOpen("C:\Dessert.txt", 0) $Num_app = _FileCountLines ($file_app1) + 1 $Num_ent = _FileCountLines ($file_ent1) + 1 $Num_des = _FileCountLines ($file_des1) + 1 $asd = "" $fgh = "" $jkl = "" For $asd = 1 To $Num_app Step 1 GUICtrlCreateListViewItem(FileReadLine($file_app1, $Num_app), $List1) Next For $fgh = 1 To $Num_des Step 1 GUICtrlCreateListViewItem(FileReadLine($file_des1, $Num_des), $List3) Next For $jkl = 1 To $Num_ent Step 1 GUICtrlCreateListViewItem(FileReadLine($file_ent1, $Num_ent), $List2) Next $Pic1 = GUICtrlCreatePic("C:\Documents and Settings\Hunter\Desktop\BG.jpg", 0, 0, 548, 228, BitOR($SS_NOTIFY, $WS_GROUP, $WS_CLIPSIBLINGS)) GUISetState(@SW_SHOW) #EndRegion ### START Koda GUI section ### Form= While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE FileClose($file_app1) FileClose($file_ent1) FileClose($file_des1) FileDelete("C:\Menu.xml") FileDelete("C:\Appetizer.txt") FileDelete("C:\Entree.txt") FileDelete("C:\Dessert.txt") Exit Case $Button1 MsgBox(0, "", $file_app) MsgBox(0, "", $file_ent) MsgBox(0, "", $file_des) EndSwitch WEnd It creates the .txt files with all the right things and creates only the first ListView item. Not the rest. How do I fix this? My goal is to have it split the XML into seperate lines in seperate txt files, which works. But when I try to read the txt files and put them into the ListView it only puts the first one. How can I fix this? ;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
Firefoxy Posted May 17, 2008 Author Posted May 17, 2008 For $asd = 1 To $Num_app Step 1 GUICtrlCreateListViewItem(FileReadLine($file_app1, $Num_app) & "|", $List1) Next For $fgh = 1 To $Num_des Step 1 GUICtrlCreateListViewItem(FileReadLine($file_des1, $Num_des) & "|", $List3) Next For $jkl = 1 To $Num_ent Step 1 GUICtrlCreateListViewItem(FileReadLine($file_ent1, $Num_ent) & "|", $List2) Next No, didn't work. Thanks though. ;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
Hiyoal Posted May 17, 2008 Posted May 17, 2008 (edited) This works $Num_app = _FileCountLines("C:\Appetizer.txt") + 1 $Num_ent = _FileCountLines ("C:\Entree.txt") + 1 $Num_des = _FileCountLines ("C:\Dessert.txt") + 1 $file_app1 = FileOpen("C:\Appetizer.txt", 0) $file_ent1 = FileOpen("C:\Entree.txt", 0) $file_des1 = FileOpen("C:\Dessert.txt", 0) $asd = "" $fgh = "" $jkl = "" For $asd = 1 To $Num_app Step 1 GUICtrlCreateListViewItem(FileReadLine($file_app1, $asd), $list1) Next For $fgh = 1 To $Num_des Step 1 GUICtrlCreateListViewItem(FileReadLine($file_des1, $fgh), $List3) Next For $jkl = 1 To $Num_ent Step 1 GUICtrlCreateListViewItem(FileReadLine($file_ent1, $jkl), $List2) NextYou were making the _FileCountLines read a number, not a path. Also, once you had read the lines, you were making FileReadLine read the very last line of the file, instead of the first. So making FileReadLine($file_app1,$asd) makes it read the first line to the last.Hiyoal Edited May 17, 2008 by Hiyoal
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now