Jump to content

Generate program list


Recommended Posts

What method does one use to generate a list of programs on the local machine?

Building an application list for the user to choose a default application... not sure how to approach enumerating the programs. Drop a hint for me?

Thanks.

Spoiler

“Hello, ladies, look at your man, now back to me, now back at your man, now back to me. Sadly, he isn’t me, but if he stopped using ladies scented body wash and switched to Old Spice, he could smell like he’s me. Look down, back up, where are you? You’re on a boat with the man your man could smell like. What’s in your hand, back at me. I have it, it’s an oyster with two tickets to that thing you love. Look again, the tickets are now diamonds. Anything is possible when your man smells like Old Spice and not a lady. I’m on a horse.”

 

Link to comment
Share on other sites

  • Moderators

I use this, which I cobbled together with the help of several on the forum. Can't recall if I ever finished the right-click uninstall feature, but it should give you a place to start.

Enumerate Local Apps with Uninstall.au3

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

hmm, can you convert this to your liking? I'll try to pretty it up. I need to fix up the mylistbox, I used a homemade one to select via double click

$proglist= winlist()
$labellistbox= guictrlcreatelabel("Select window title to activate", 26, 175, 560, 20, $ss_center)
$mylistbox= guictrlcreatelist("", 26, 195, 560, 331)
guictrlsetstate($mylistbox, $gui_show)
for $i= 1 to $proglist[0][0]
   if $proglist[$i][0]<>"" then guictrlsetdata($mylistbox, $proglist[$i][0]&"|")
next

while 1
   $msg= guigetmsg()
   if _ispressed("0d") or $mylistboxmsg= 1 then;enter
      $mylistboxmsg= 0
      guictrlsetdata($, guictrlread($mylistbox))
      exitloop
   endif
   if _ispressed("1B") or $msg= $gui_event_close then;escape
      exitloop
   endif
wend
guictrldelete($labellistbox)
guictrldelete($mylistbox)

global $mylistbox= 0
global $mylistboxmsg= 0
;I am not the author of this function
Func _WM_COMMAND($hWnd, $msg, $wParam, $lParam)
    local $nCode = bitshift($wParam, 16) ; HiWord
    local $nIDFrom = bitand($wParam, 0xFFFF)       ; LoWord
    Switch $nIDFrom
        Case $mylistbox
            Switch $nCode
                Case $LBN_DBLCLK
                    $sListItem = guictrlread($mylistbox) ; Read selected item
                    $mylistboxmsg= 1
            EndSwitch
    EndSwitch
    return $GUI_RUNDEFMSG
EndFunc   ;==>_WM_COMMAND

If you wanted installed programs, i'll be interested to see a solution. Neat JLogan3o13, I can follow that example.

Edited by Xandy
Link to comment
Share on other sites

I use this, which I cobbled together with the help of several on the forum. Can't recall if I ever finished the right-click uninstall feature, but it should give you a place to start.

Enumerate Local Apps with Uninstall.au3

I see you recurse over the registry to grab the uninstall info. Do you know of a key that holds the .exe locations?
Spoiler

“Hello, ladies, look at your man, now back to me, now back at your man, now back to me. Sadly, he isn’t me, but if he stopped using ladies scented body wash and switched to Old Spice, he could smell like he’s me. Look down, back up, where are you? You’re on a boat with the man your man could smell like. What’s in your hand, back at me. I have it, it’s an oyster with two tickets to that thing you love. Look again, the tickets are now diamonds. Anything is possible when your man smells like Old Spice and not a lady. I’m on a horse.”

 

Link to comment
Share on other sites

I see you recurse over the registry to grab the uninstall info. Do you know of a key that holds the .exe locations?

If you look in the same location as where he gets the Uninstall string, there's a key called "InstallLocation" which is where the software was installed to.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

!!! this is nice... found some keys in HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindowsCurrentVersionApp Paths. It holds most if not all of the .exe locations.

Spoiler

“Hello, ladies, look at your man, now back to me, now back at your man, now back to me. Sadly, he isn’t me, but if he stopped using ladies scented body wash and switched to Old Spice, he could smell like he’s me. Look down, back up, where are you? You’re on a boat with the man your man could smell like. What’s in your hand, back at me. I have it, it’s an oyster with two tickets to that thing you love. Look again, the tickets are now diamonds. Anything is possible when your man smells like Old Spice and not a lady. I’m on a horse.”

 

Link to comment
Share on other sites

Sorry if you saw my last post I deleted XD. I split it into a function and didn't test it =/.

Threw this together...

#include <Array.au3>

$asEXEs = _EnumEXEs() ; Returns an array of Programs. Col.0 = Base name, Col.1 = Full Path
If msgbox(4 + 64 + 262144 ,"Programs", "Programs Found." &amp;amp; @LF &amp;amp; @LF &amp;amp; "Do you wish to view them?") = 6 Then
    _ArrayDisplay($asEXEs, "Program List", -1, Default, "", "", "Index|Program Name|Program Full Path")
Else
    Exit
EndIf

Func _EnumEXEs()
    $i = 0
    $x = 1
    $sKey = "HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindowsCurrentVersionApp Paths"
    Local $asProg[999][2]
    While 1
        $fKey = RegEnumKey($sKey, $x)
        $x+=1
        If Not $fKey Then ExitLoop
        $fProg = RegRead($sKey &amp;amp; "" &amp;amp; $fKey, "")
        If Not $fProg Then ContinueLoop
        $asProg[$i][1] = StringReplace($fProg, '"', "")
        $asSplit = StringSplit($asProg[$i][1], "")
        $asProg[$i][0] = $asSplit[$asSplit[0]]
        $i+=1
    WEnd
    ReDim $asProg[$i][2]

    Return $asProg
EndFunc

EDIT: Removed defining $asSplit in function

Well it looks like it doesn't grab all applications.

Edited by mechaflash213
Spoiler

“Hello, ladies, look at your man, now back to me, now back at your man, now back to me. Sadly, he isn’t me, but if he stopped using ladies scented body wash and switched to Old Spice, he could smell like he’s me. Look down, back up, where are you? You’re on a boat with the man your man could smell like. What’s in your hand, back at me. I have it, it’s an oyster with two tickets to that thing you love. Look again, the tickets are now diamonds. Anything is possible when your man smells like Old Spice and not a lady. I’m on a horse.”

 

Link to comment
Share on other sites

These are the three* threads i played in when figuring out how to enumerate and use the uninstall string.

Edited by boththose

,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-.
|(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/
(_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_)
| | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) (
| | | | |)| | \ / | | | | | |)| | `--. | |) \ | |
`-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_|
'-' '-' (__) (__) (_) (__)

Link to comment
Share on other sites

Okay... round 2... iterated over the uninstall section looking for keys that have the InstallLocation value. I think this is much closer.

#include <Array.au3>
#include <File.au3>
#include <RecFileListToArray.au3>

$asEXEs = _EnumEXEs() ; Returns an array of Programs. Col.0 = Base name, Col.1 = Full Path
If msgbox(4 + 64 + 262144 ,"Programs", "Programs Found." & @LF & @LF & "Do you wish to view them?") = 6 Then
    _ArrayDisplay($asEXEs, "Program List", -1, Default, "", "", "Index|Program Name|Program Full Path")
Else
    Exit
EndIf

Func _EnumEXEs()
    $i = 0
    $x = 1
    $sKey = "HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindowsCurrentVersionUninstall"
    Local $asProg[999][2]
    Local $asSplit[5]
    While 1
        $fKey = RegEnumKey($sKey, $x)
        $x+=1
        If Not $fKey Then ExitLoop
        $fProg = StringReplace(RegRead($sKey & "" & $fKey, "InstallLocation"), '"', "")
        If Not $fProg Then ContinueLoop
;~      msgbox(0,"",$fProg)
        $asFiles = _RecFileListToArray($fProg, "*.exe", 1, 0, 0, 2)
        If @error <> 0 Then ContinueLoop
        For $z = 1 To $asFiles[0]
            $asSplit = StringSplit($asFiles[$z], "")
            $asProg[$i][0] = $asSplit[$asSplit[0]]
            $asProg[$i][1] = $asFiles[$z]
            $i+=1
        Next
    WEnd
    ReDim $asProg[$i][2]

    Return $asProg
EndFunc
Edited by mechaflash213
Spoiler

“Hello, ladies, look at your man, now back to me, now back at your man, now back to me. Sadly, he isn’t me, but if he stopped using ladies scented body wash and switched to Old Spice, he could smell like he’s me. Look down, back up, where are you? You’re on a boat with the man your man could smell like. What’s in your hand, back at me. I have it, it’s an oyster with two tickets to that thing you love. Look again, the tickets are now diamonds. Anything is possible when your man smells like Old Spice and not a lady. I’m on a horse.”

 

Link to comment
Share on other sites

I just remembered something, the Uninstall information in the registry is also in "HKEY_LOCAL_MACHINESOFTWAREWow6432NodeMicrosoftWindowsCurrentVersionUninstall" on x64 versions of Windows for stuff that's installed into "C:Program Files (x86)"

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

Why do you set the size of the array at 999? Look at ReDim or _ReDim in my signature (the effective approach.)

UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Link to comment
Share on other sites

I just remembered something, the Uninstall information in the registry is also in "HKEY_LOCAL_MACHINESOFTWAREWow6432NodeMicrosoftWindowsCurrentVersionUninstall" on x64 versions of Windows for stuff that's installed into "C:Program Files (x86)"

Ugh... I'll add that in... just thought of something else too... HKCU also has its own key for programs only installed for that user...

Why do you set the size of the array at 999? Look at ReDim or _ReDim in my signature (the effective approach.)

I see... so for my example I can set it to 50, if it hits 50, redim it +50, then if it hits 100 another +50 ? Then after the loop is done, redim it to it's final size.

Edited by mechaflash213
Spoiler

“Hello, ladies, look at your man, now back to me, now back at your man, now back to me. Sadly, he isn’t me, but if he stopped using ladies scented body wash and switched to Old Spice, he could smell like he’s me. Look down, back up, where are you? You’re on a boat with the man your man could smell like. What’s in your hand, back at me. I have it, it’s an oyster with two tickets to that thing you love. Look again, the tickets are now diamonds. Anything is possible when your man smells like Old Spice and not a lady. I’m on a horse.”

 

Link to comment
Share on other sites

Yeh something like that, though I would personally check the size and then work out if it needs to be ReDim'd. _ReDim explains how to go about this.

UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Link to comment
Share on other sites

I was thinking... what about enumerating the Start menu's programs list, looking up the properties for the shortcut to find the path to the exe?

Cause after enumerating just the HKLM uninstall key, i've got 180+ programs. For my personal usage of this function, I don't need all of the random pre-installed system apps. On top of that, some of these folders contain multiple .exe files in the 'InstallLocation' folder, and most of the time, those additional exes aren't meant to be accessed directly.

I'm gonna do another test...

Spoiler

“Hello, ladies, look at your man, now back to me, now back at your man, now back to me. Sadly, he isn’t me, but if he stopped using ladies scented body wash and switched to Old Spice, he could smell like he’s me. Look down, back up, where are you? You’re on a boat with the man your man could smell like. What’s in your hand, back at me. I have it, it’s an oyster with two tickets to that thing you love. Look again, the tickets are now diamonds. Anything is possible when your man smells like Old Spice and not a lady. I’m on a horse.”

 

Link to comment
Share on other sites

  • Moderators

Here is one I used to use for enumerating applications on remote machines. It is several years old, so no promises as to being my best effort - but it does show how to loop through and remove things such as Windows Updates from the resulting array.

Enumerate Remote Apps.au3

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

Here's how I did it, I just looked for the /kb/ string in the "MoreInfoURL" key, which is almost 100% of the time a Windows Update.

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#Tidy_Parameters=/rel /uv 3 /proper 1
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#include <Array.au3>
#include <GuiListView.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
AutoItSetOption("WinTitleMatchMode", 2)
Opt("Guioneventmode", 1)
Opt("MustDeclareVars", 1)
Global $Updates[1000][2], $Checked = 0
Global $aAddRemoveWithUpdates[1]
Global $Timer = TimerInit()
Global $hGUI = GUICreate("Uninstaller", 600, 500, -1, -1, BitOR($WS_THICKFRAME, BitXOR($GUI_SS_DEFAULT_GUI, $WS_MINIMIZEBOX)))
GUISetOnEvent($GUI_EVENT_CLOSE, "Close")
Global $Button = GUICtrlCreateButton(" Uninstall ", 50, 10, 80)
GUICtrlSetFont(-1, 10, 800)
GUICtrlSetOnEvent(-1, "button")
GUICtrlSetResizing($Button, 768 + 32)
GUICtrlSetTip(-1, "Uninstall the selected items")
Global $inclUpdates = GUICtrlCreateCheckbox("Include listing updates?", 250, 10)
GUICtrlSetResizing($inclUpdates, 768 + 32)
GUICtrlSetOnEvent(-1, "Checkbox")
Global $ListView = GUICtrlCreateListView("Program Name|Uninstall String", 20, 40, 560, 430, -1, BitOR($LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT, $LVS_EX_CHECKBOXES))
GUICtrlSetResizing($ListView, 102)
Global $hListView = GUICtrlGetHandle($ListView)
Global $AddRemove = _SoftwareInfo($Updates)
_ArraySort($AddRemove, 0, 0)
_ArraySort($Updates, 0, 0)
Global $aAddRemove[UBound($AddRemove)][2]
For $I = 0 To UBound($AddRemove) - 1
 $aAddRemove[$I][0] = $AddRemove[$I][0]
 $aAddRemove[$I][1] = $AddRemove[$I][1]
Next
_GUICtrlListView_AddArray($hListView, $aAddRemove)
GUICtrlSendMsg($ListView, 4126, 1, 0)
GUICtrlSendMsg($ListView, 4126, 0, -1)
Global $SubMax = UBound($aAddRemove, 2) - 1
Global $iWidth = 0
$iWidth += GUICtrlSendMsg($ListView, (0x1000 + 29), 0, 0)
If $iWidth < 250 Then $iWidth = 250
$iWidth += 80
If $iWidth > @DesktopWidth Then $iWidth = @DesktopWidth - 100
WinMove($hGUI, "", (@DesktopWidth - $iWidth) / 2, Default, $iWidth)
GUISetState()
While 1
 Sleep(100)
WEnd
Func Checkbox()
 If GUICtrlRead($inclUpdates) = $GUI_CHECKED Then
  Local $Temp = UBound($aAddRemove)
  $aAddRemoveWithUpdates = $aAddRemove
  ReDim $aAddRemoveWithUpdates[$Temp + UBound($Updates) - 1][2]
  For $I = $Temp To UBound($aAddRemoveWithUpdates) - 1
   $aAddRemoveWithUpdates[$I][0] = $Updates[$I - ($Temp - 1)][0]
   $aAddRemoveWithUpdates[$I][1] = $Updates[$I - ($Temp - 1)][1]
  Next
  _GUICtrlListView_DeleteAllItems($hListView)
  _ArraySort($aAddRemoveWithUpdates, 0, 0, 0, 0)
  _GUICtrlListView_AddArray($hListView, $aAddRemoveWithUpdates)
 Else
  _GUICtrlListView_DeleteAllItems($hListView)
  _ArraySort($AddRemove, 0, 0, 0, 0)
  _GUICtrlListView_AddArray($hListView, $aAddRemove)
 EndIf
 GUICtrlSendMsg($ListView, 4126, 1, 0)
 GUICtrlSendMsg($ListView, 4126, 0, -1)
 Global $SubMax = UBound($aAddRemove, 2) - 1
 Global $iWidth = 0
 $iWidth += GUICtrlSendMsg($ListView, (0x1000 + 29), 0, 0)
 If $iWidth < 250 Then $iWidth = 250
 $iWidth += 80
 If $iWidth > @DesktopWidth Then $iWidth = @DesktopWidth - 100
 WinMove($hGUI, "", (@DesktopWidth - $iWidth) / 2, Default, $iWidth)
EndFunc   ;==>Checkbox
Func close()
 Exit
EndFunc   ;==>close
Func Button()
 Local $Return, $Error
 For $I = _GUICtrlListView_GetItemCount($hListView) - 1 To 0 Step -1
  Local $Checked = _GUICtrlListView_GetItemChecked($hListView, $I)
  If $Checked = True Then
   Local $Text = _GUICtrlListView_GetItemText($hListView, $I, 1)
   $Text = Chr(34) & $Text
   $Text = StringReplace($Text, ".exe", ".exe" & Chr(34))
   $Text = StringReplace($Text, '""', '"')
   ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $Text = ' & $Text & @CRLF & '>Error code: ' & @error & @CRLF) ;### Debug Console
   If StringInStr($Text, ".exe" & Chr(34)) Then
    $Return = RunWait($Text)
    $Error = @error
   Else
    $Return = ShellExecuteWait($Text)
    $Error = @error
   EndIf
   ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') ' & @HOUR & ":" & @MIN & ': $Return = ' & $Return & @CRLF & '>Error code: ' & @error & @CRLF) ;### Debug Console
   If Not $Return And Not $Error Then
    _GUICtrlListView_DeleteItem($hListView, $I)
    _ArrayDelete($aAddRemove, $I)
   Else
    MsgBox(64, "Error", "There was an error while uninstalling " & _GUICtrlListView_GetItemText($hListView, $I, 0) & @CRLF & _
      "The returned message was: " & $Return & @CRLF & "The Error message was: " & $Error)
   EndIf
  EndIf
 Next
 Return
EndFunc   ;==>Button
Func _SoftwareInfo(ByRef $New)
 Local $Count = 1, $Count1 = 1, $Count2 = 1
 Local Const $regkey = 'HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindowsCurrentVersionUninstall'
 While 1
  Local $key = RegEnumKey($regkey, $Count1)
  If @error <> 0 Then ExitLoop
  Local $line = RegRead($regkey & '' & $key, 'Displayname')
  Local $line2 = RegRead($regkey & "" & $key, "MoreInfoURL")
  Local $line3 = RegRead($regkey & "" & $key, "UninstallString")
  If $line <> '' And $line3 <> "" And Not StringInStr($line, "Office Suite Service Pack", 0) Then
   If StringMid($line2, StringLen($line2) - 9, 4) <> "/kb/" Then
    If Not IsDeclared('avArray') Then Dim $avArray[100][2]
    If UBound($avArray) - $Count <= 1 Then ReDim $avArray[UBound($avArray) + 100][2]
    $avArray[$Count - 1][0] = $line
    $avArray[$Count - 1][1] = $line3
    $Count = $Count + 1
   Else
    If UBound($New) - $Count2 <= 1 Then ReDim $New[UBound($New) + 100][2]
    $New[$Count2 - 1][0] = $line
    $New[$Count2 - 1][1] = $line3
    $Count2 = $Count2 + 1
   EndIf
  EndIf
  $Count1 += 1
 WEnd
 If Not IsDeclared('avArray') Or Not IsArray($avArray) Then
  Return (SetError(1, 0, ''))
 Else
  ReDim $avArray[$Count - 1][2]
  If $Count2 > 1 Then
   ReDim $New[$Count2 - 1][2]
  Else
   $New = ""
  EndIf
  Return (SetError(0, 0, $avArray))
 EndIf
EndFunc   ;==>_SoftwareInfo

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

Round 3... so I whipped this up... I keep looking at it though like I was stupid for writing it the way I did with the nested For loops... I couldn't think of any other way to write it.

Anyways... tested and works. I believe this is what I'll end up using if you guys don't see a possible issue doing it this way.

#include <Array.au3>
#include <File.au3>
#include <RecFileListToArray.au3>

$asEXEs = _EnumEXEs() ; Returns an array of Programs. Col.0 = Base name, Col.1 = Full Path
If msgbox(4 + 64 + 262144 ,"Programs", UBound($asEXEs) &amp;amp;amp; " Programs Found." &amp;amp;amp; @LF &amp;amp;amp; @LF &amp;amp;amp; "Do you wish to view them?") = 6 Then
    _ArrayDisplay($asEXEs, "Program List", -1, Default, "", "", "Index|Program Name|Program Full Path")
Else
    Exit
EndIf

Func _EnumEXEs()
    Local $i, $iCount
    Local $asProg[50][2], $asPaths[2]
    $asPaths[0] = @ProgramsCommonDir
    $asPaths[1] = @ProgramsDir
    For $paths in $asPaths
        $asFolders = _RecFileListToArray($paths, "*", 2, 0, 0, 2)
        If @error <> 0 Then Return SetError(1,0,1)
        For $y = 1 To $asFolders[0]
            $asFiles = _RecFileListToArray($asFolders[$y], "*.lnk", 1, 0, 0, 2)
            If @error Then ContinueLoop
            For $x = 1 To $asFiles[0]
                $asShortCut = FileGetShortcut($asFiles[$x])
                If @error Then ContinueLoop
                If Not FileExists($asShortCut[0]) Or StringRight($asShortCut[0], 3) <> "exe" Then ContinueLoop
                $asSplit = StringSplit($asShortCut[0], "")
                $asProg[$i][0] = $asSplit[$asSplit[0]]
                $asProg[$i][1] = $asShortCut[0]
                $i+=1
                If $i >= UBound($asProg) Then ReDim $asProg[$i+50][2]
            Next
        Next
    Next

    ReDim $asProg[$i][2]
    _ArraySort($asProg,0,0,0,1)

    For $j = 1 To UBound($asProg, 1) - 1
        While 1
            If $asProg[$j][1] = $asProg[$j-1][1] Then
                $iCount = _ArrayDelete($asProg, $j)
            Else
                ExitLoop
            EndIf

        WEnd
        If $iCount - 1 = $j Then ExitLoop
    Next

    _ArraySort($asProg)

    Return $asProg
EndFunc
Edited by mechaflash213
Spoiler

“Hello, ladies, look at your man, now back to me, now back at your man, now back to me. Sadly, he isn’t me, but if he stopped using ladies scented body wash and switched to Old Spice, he could smell like he’s me. Look down, back up, where are you? You’re on a boat with the man your man could smell like. What’s in your hand, back at me. I have it, it’s an oyster with two tickets to that thing you love. Look again, the tickets are now diamonds. Anything is possible when your man smells like Old Spice and not a lady. I’m on a horse.”

 

Link to comment
Share on other sites

One thing I noticed with "Enumerate Local Apps with Uninstall().au3" is that it doesn't seem to find Google Chrome, even though it's installed.

Anyone know why this is, and what other installed s/ware might be missed?

That might have something to with the fact that Chrome by default installs to the user profile.

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