Sign in to follow this  
Followers 0
Kogmedia

Problem List View

7 posts in this topic

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

Share this post


Link to post
Share on other sites



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

Share this post


Link to post
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

Share this post


Link to post
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

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  
Followers 0