Jump to content

Listview with multiple entries


TuMiM
 Share

Recommended Posts

I am trying to create a small program that basically runs an xcopy command from one directory to another when the button is pressed. I want the output of the files that were copied to appear in the listview I created. There are about 20 files being copied but they are all showing in the listview box on the same line so you can't see any other than the first. How can I get them to list down?

#include <GuiConstants.au3>

Opt("GUIOnEventMode",1)

GuiCreate("MyGUI", 392, 316,(@DesktopWidth-392)/2, (@DesktopHeight-316)/2 ,

$Button_1 = GuiCtrlCreateButton("Copy Files", 130, 70, 130, 30)

GUICtrlSetOnEvent($Button_1,"Copy")

$Label_2 = GuiCtrlCreateLabel("Please click on the button below to synchronize subtitle

files", 50, 35, 300, 25)

$list= GUICtrlCreateListView ("Files Copied ", 80, 125, 220, 150)

GUISetOnEvent($GUI_EVENT_CLOSE,"OnExit")

GuiSetState()

While 1

$msg = GuiGetMsg()

Select

Case $msg = $GUI_EVENT_CLOSE

ExitLoop

Case Else

;;;

EndSelect

WEnd

Exit

;--------------- Functions ---------------

Func Copy()

RunWait(@ComSpec & " /c " & 'xcopy c:\complete\*.* c:\complete1

/S/E/Y/D>c:\Filecopy.txt',"c:\", @SW_HIDE)

$fc = FileRead("c:" & "\Filecopy.txt", FileGetSize("c:" & "\Filecopy.txt"))

FileDelete("c:" & "\Filecopy.txt")

GUICtrlCreateListViewItem ($fc, $list)

EndFunc

Func OnExit()

Exit

EndFunc

Link to comment
Share on other sites

$fc = FileRead("c:" & "\Filecopy.txt", FileGetSize("c:" & "\Filecopy.txt"))

FileDelete("c:" & "\Filecopy.txt")

GUICtrlCreateListViewItem ($fc, $list)

<{POST_SNAPBACK}>

Change your fileread to _FileReadToArray then step through each element in the array greating a different listviewitem for each element.

There are probably about twenty other ways to do it too, but this way should be fairly easy.

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