Kogmedia Posted April 30, 2007 Posted April 30, 2007 Hello, I have been playing with this all day but I haven't got anywhere. I want to output a text file to an item list I have manged to do this. But I can't figure out how to edit the list the results, or output the edited results to a new text file? I have tried all the list controls in the help file but can't get them work in the script? #Include<Array.au3> #include <file.au3> #include <GUIConstants.au3> #include <GuiList.au3> ;Opt ('MustDeclareVars', 0) dim $listbox,$button,$pricehistory,$num,$found,$filename,$list,$msg,$ret,$ans,$Status $header = "Item Number|Cat ID|Auction Title|Price|BIN|ID2|ID3|?|?|Seller|Buyer|Contry|ID3|?|" GUICreate("Watchlist/PriceHistory Viewer",800,600, 100,200,-1) $listbox = GUICtrlCreateListView($header,0,0,800,600) $filename = "pricehistory.txt" _FileReadToArray($filename,$pricehistory) For $x = 2 to $pricehistory[0] $pricehistory[$x]= StringRegExpReplace ( $pricehistory[$x], " ", "|") $listitem = GUICtrlCreateListViewItem($pricehistory[$x],$listbox) Next GUISetState() Do $msg = GUIGetMsg () Until $msg = $GUI_EVENT_CLOSE [font="Verdana"]Keith (Kogmedia)[/font]My ScriptQuick Search - Internet / Hard Drive Search
Zedna Posted April 30, 2007 Posted April 30, 2007 For save data from ListView to text file use _GUICtrlListViewGetItemText() Resources UDF ResourcesEx UDF AutoIt Forum Search
Kogmedia Posted April 30, 2007 Author Posted April 30, 2007 For save data from ListView to text file use _GUICtrlListViewGetItemText()_GUICtrlListViewGetItemText($listbox,1)I get the ERROR: _GUICtrlListViewGetItemText(): undefined function. [font="Verdana"]Keith (Kogmedia)[/font]My ScriptQuick Search - Internet / Hard Drive Search
Zedna Posted April 30, 2007 Posted April 30, 2007 _GUICtrlListViewGetItemText($listbox,1) I get the ERROR: _GUICtrlListViewGetItemText(): undefined function. You must add at top of your script: #Include <GuiListView.au3> Resources UDF ResourcesEx UDF AutoIt Forum Search
Kogmedia Posted April 30, 2007 Author Posted April 30, 2007 Is there a way to output the whole list to a text file? [font="Verdana"]Keith (Kogmedia)[/font]My ScriptQuick Search - Internet / Hard Drive Search
Zedna Posted April 30, 2007 Posted April 30, 2007 Is there a way to output the whole list to a text file? #Include <GuiListView.au3> ; GUI stuff ... SaveListView($listview1, 'C:\listview_data.txt') Func SaveListView($list, $file) $data = '' For $i = 0 To _GUICtrlListViewGetItemCount($list) - 1 $data &= _GUICtrlListViewGetItemText($list, $i) & @CRLF Next $data = StringTrimRight($data,2) FileDelete($file) FileWrite($file, $data) EndFunc Resources UDF ResourcesEx UDF AutoIt Forum Search
Kogmedia Posted April 30, 2007 Author Posted April 30, 2007 #Include <GuiListView.au3> ; GUI stuff ... SaveListView($listview1, 'C:\listview_data.txt') Func SaveListView($list, $file) $data = '' For $i = 0 To _GUICtrlListViewGetItemCount($list) - 1 $data &= _GUICtrlListViewGetItemText($list, $i) & @CRLF Next $data = StringTrimRight($data,2) FileDelete($file) FileWrite($file, $data) EndFunc Thanks! [font="Verdana"]Keith (Kogmedia)[/font]My ScriptQuick Search - Internet / Hard Drive Search
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