Jump to content

Problem List View


Recommended Posts

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
Link to comment
Share on other sites

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
Link to comment
Share on other sites

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