Jump to content

Populate list from text file


ttabol
 Share

Recommended Posts

All - I'm trying to use a text file with the following format: 10/11/2006,Jones,Jim,1234567890 to populate a list in my GUI, I've tried about a thousand different ways to do it without any luck. So, any suggestions on how this could best be done? The file will likely contain up to 300 of these entries. Thanks! - Tim

Link to comment
Share on other sites

A simple script with a function to add a list view item:

GUICreate ( "List populator thing", 300, 300 )
$list = GUICtrlCreateListView ( "Date|Last|First|???", 5, 5, 290, 290 )
$newitem = AddToList ( "10/11/2006,Jones,Jim,1234567890", $list )
GUISetState ( )
While GUIGetMsg() <> -3
    Sleep ( 1 )
WEnd
Func AddToList ( $stringtoadd, $listid )
    $stringtoadd = StringSplit ( $stringtoadd, "," )
    $listviewstring = ""
    For $n = 1 To $stringtoadd[0]
        $listviewstring &= $stringtoadd[$n] & "|"
    Next
    Return GUICtrlCreateListViewItem ( $listviewstring, $listid )
EndFunc

The function uses bad coding techniques so you should modify it before you use it.

Just go through a file line by line and use the method I just showed you.

Edited by Xenogis

[font="Times"] If anyone remembers me, I am back. Maybe to stay, maybe not.----------------------------------------------------------------------------------------------------------[/font][font="Times"]Things I am proud of: Pong! in AutoIt | SearchbarMy website: F.R.I.E.S.A little website that is trying to get started: http://thepiratelounge.net/ (not mine)[/font][font="Times"] ----------------------------------------------------------------------------------------------------------[/font][font="Arial"]The newbies need to stop stealing avatars!!! It is confusing!![/font]

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