Jump to content

Need help with populating ListView box.


Recommended Posts

I have the following script and I cannot seem to populate the listview control with the element in the array.  The _arraydisplay shows that the script is finding the files.  What am I doing wrong?  Please help.

$1Sign = GUICreate("Scripting @LH", 282, 369, -1, -1)
$Group1 = GUICtrlCreateGroup(" File(s) to sign ", 8, 32, 265, 297)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
$ListView1 = GUICtrlCreateListView("", 16, 56, 250, 262, -1, BitOR($WS_EX_CLIENTEDGE, $LVS_EX_GRIDLINES, $LVS_EX_CHECKBOXES, $LVS_EX_FULLROWSELECT))
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Button_Sign = GUICtrlCreateButton("Sign File", 198, 336, 75, 25)
$Label1 = GUICtrlCreateLabel("1Sign - Assistant", 76, 0, 130, 27, $SS_CENTER)
GUICtrlSetFont(-1, 14, 400, 4, "calibri")
$Checkbox1 = GUICtrlCreateCheckbox("Select All", 120, 340, 73, 17)
Global $sApps_Dir = "C:\1Sign\"
_GetFile()
GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Checkbox1
            If GUICtrlRead($Checkbox1) = $GUI_CHECKED Then
                _SelectAll()
            Else
                _DeSelectAll()
            EndIf
    EndSwitch
WEnd

Func _GetFile()
    $GetFirstFile = FileFindFirstFile($sApps_Dir & "*.*")
    If $GetFirstFile = -1 Then
        Exit
    EndIf
    Dim $array[1]
    $i = 0
    Do
        $GetNextFile = FileFindNextFile($GetFirstFile)
        If Not @error Then
            $array[$i] = $GetNextFile
            $i += 1
            ReDim $array[$i + 1]
        EndIf
    Until @error
    ReDim $array[$i]
    _ArrayDisplay($array)
    For $i = 1 To UBound($array) Step 1
        GUICtrlCreateListViewItem($array[$i - 1], $ListView1)
    Next
EndFunc   ;==>_GetFile

 

Link to comment
Share on other sites

Nevermind, LOL!  I forgot to set the parameter for the listview box.  The following changed fixed it for me.

$ListView1 = GUICtrlCreateListView("FileName", 16, 56, 250, 262, -1, BitOR($WS_EX_CLIENTEDGE, $LVS_EX_GRIDLINES, $LVS_EX_CHECKBOXES, $LVS_EX_FULLROWSELECT))

Link to comment
Share on other sites

Because it's only one column, but if you have more you have to set how many columns by setting the separator char, something like this if you don't set a different one:

"col1|col2|col3" | is the separator
Spoiler

Renamer - Rename files and folders, remove portions of text from the filename etc.

GPO Tool - Export/Import Group policy settings.

MirrorDir - Synchronize/Backup/Mirror Folders

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

String Trigger - Triggers pasting text or applications or internet links on specific strings.

Inconspicuous - Hide files in plain sight, not fully encrypted.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

IUIAutomation - Topic with framework and examples

Au3Record.exe

Link to comment
Share on other sites

Thanks Careca.  I found out about the "pipe separator" shortly after discovering that I was missing the column parameter.  Sometimes, I just need to slow down and read the examples SUPER carefully.  :)

 

Edited by LisHawj
Link to comment
Share on other sites

Yes i meant pipe separator, but sometimes i forget about the terms. :P

Spoiler

Renamer - Rename files and folders, remove portions of text from the filename etc.

GPO Tool - Export/Import Group policy settings.

MirrorDir - Synchronize/Backup/Mirror Folders

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

String Trigger - Triggers pasting text or applications or internet links on specific strings.

Inconspicuous - Hide files in plain sight, not fully encrypted.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

IUIAutomation - Topic with framework and examples

Au3Record.exe

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