Sign in to follow this  
Followers 0
ca143508

ListView & TXT file

5 posts in this topic

Guys,

I have a text file that has listed in it all the aoftware installed on my machine. I want to take that information and drop it into a list on my Gui so that it is viewable while the application runs. Does anyone have any code or can help me out with this? Any help is greatly appreciated.

Cheers,

Mike.

Share this post


Link to post
Share on other sites



if you show us some code... maybe we can help direct you

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

Func SoftwareAudit()

$RegKey = "HKey_Local_machine\software\microsoft\windows\currentversion\uninstall\"

$Count = 1

FileWriteLine(@WorkingDir & @Computername & ".txt","Software Audit of " & @UserName & "'s Computer." & @CRLF & "" & @CRLF)

While 1

$Key = RegEnumKey($RegKey, $Count)

If @error <> 0 Then ExitLoop

$ProductName = RegRead($RegKey & "\" & $Key,"DisplayName")

If $ProductName = "" Then

$Count = $Count + 1

ContinueLoop

EndIf

FileWriteLine(@WorkingDir & @Computername & ".txt",$ProductName)

$Count = $Count + 1

WEnd

MsgBox(0,"" & $ApplicationTitle,"The audit is now complete. ")

EndFunc

So this code gives me the list of software installed. The next part I want to do is take what it gathers and display it within my GUI.

Cheers

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

I think with some adapatation this will do the trick. You may want to do some If Then statements at some point to strip out the Windows Updates since this grabs those two and you probably don't care so much about them... Or maybe you do and want to consider them in a different way.

BTW, in your FileWriteLines, you need a "\" in between @WorkingDir and @Computername because @WorkingDir doesn't include it.

Dim $ApplicationTitle
#include <GUIConstants.au3>
#include <File.au3>
#include <Array.au3>

SoftwareAudit()
GUI()

Func SoftwareAudit()
    $RegKey = "HKey_Local_machine\software\microsoft\windows\currentversion\uninstall\"
    $Count = 1
    
    While 1
        $Key = RegEnumKey($RegKey, $Count)
        If @error <> 0 Then ExitLoop
        $ProductName = RegRead($RegKey & "\" & $Key, "DisplayName")
        If $ProductName = "" Then
            $Count = $Count + 1
            ContinueLoop
        EndIf
        FileWriteLine(@WorkingDir & "\" & @ComputerName & ".txt", $ProductName)
        $Count = $Count + 1
    WEnd
EndFunc   ;==>SoftwareAudit

Func GUI()
    GUICreate("My GUI")
    GUICtrlCreateCombo("", 10, 10, 300)
    
    Dim $Array
    _FileReadToArray(@ComputerName & ".txt", $Array)
    _ArraySort($Array)
    
    FileDelete(@WorkingDir & "\" & @ComputerName & ".txt")
    
    For $x = 0 To UBound($Array) - 1
        If StringStripCR($Array[$x]) <> "" Then
            GUICtrlSetData(-1, StringStripCR($Array[$x]), StringStripCR($Array[1]))
        EndIf
    Next
    
    GUISetState()
    
    While 1
        $msg = GUIGetMsg()
        
        If $msg = $GUI_EVENT_CLOSE Then ExitLoop
    WEnd
EndFunc   ;==>GUI
Edited by exodius

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