Jump to content



Photo

Generate program list


  • Please log in to reply
34 replies to this topic

#1 Mechaflash

Mechaflash

    Sons of Anarchy

  • Active Members
  • PipPipPipPipPipPip
  • 1,358 posts

Posted 24 July 2012 - 04:04 PM

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







#2 JLogan3o13

JLogan3o13

    Down to 98

  • MVPs
  • 2,114 posts

Posted 24 July 2012 - 04:08 PM

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.


Attached File  Enumerate Local Apps with Uninstall.au3   3.96K   65 downloads
J.I spent 10 minutes reviewing code and thinking "What kind of drugs is this guy on?" before realizing it was something I wrote.My Scripts:Include Source with Compiled Script, Disk Maintenance for Windows XP, "Deal-A-Day" Sites, SCCM 2007 Front End, Windows Firewall UDF

#3 Xandy

Xandy

    Relationships, Battleships, Aircraft Carryers

  • Active Members
  • PipPipPipPipPipPip
  • 939 posts

Posted 24 July 2012 - 04:10 PM

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, 24 July 2012 - 04:49 PM.

The Humpty dance, Megadeth - Countdown To Extinction, Metallica - Blackened, The Sound of Urchin - Zen Magic Marker

Unless someone like you cares a whole awful lot, nothing is going to get better. It's just not.


#4 Mechaflash

Mechaflash

    Sons of Anarchy

  • Active Members
  • PipPipPipPipPipPip
  • 1,358 posts

Posted 24 July 2012 - 04:38 PM

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.


Attached File  Enumerate Local Apps with Uninstall.au3   3.96K   65 downloads

I see you recurse over the registry to grab the uninstall info. Do you know of a key that holds the .exe locations?
“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.”

#5 BrewManNH

BrewManNH

    באָבקעס מיט קודוצ׳ה

  • MVPs
  • 6,877 posts

Posted 24 July 2012 - 04:45 PM

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.

How to ask questions the smart way!

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 editorGUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.

GUIToolTip UDF Demo - Demo script to show how to use the GUIToolTip UDF to create and use customized tooltips.

Posted Image


#6 Mechaflash

Mechaflash

    Sons of Anarchy

  • Active Members
  • PipPipPipPipPipPip
  • 1,358 posts

Posted 24 July 2012 - 04:47 PM

!!! this is nice... found some keys in HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindowsCurrentVersionApp Paths. It holds most if not all of the .exe locations.
“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.”

#7 Mechaflash

Mechaflash

    Sons of Anarchy

  • Active Members
  • PipPipPipPipPipPip
  • 1,358 posts

Posted 24 July 2012 - 05:52 PM

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

Threw this together...

AutoIt         
#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, 24 July 2012 - 06:04 PM.

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

#8 boththose

boththose

    that means two things

  • Active Members
  • PipPipPipPipPipPip
  • 890 posts

Posted 24 July 2012 - 06:12 PM

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

http://www.autoitscript.com/forum/topic/134234-basic-uninstall-assistance-solved/

http://www.autoitscript.com/forum/topic/123146-list-installed-programs-and-system-information/page__hl__%26%23036%3Buninstkey__fromsearch__1

http://www.autoitscript.com/forum/topic/78563-how-to-query-all-installed-programs-on-remote-computer/#entry834242

Edited by boththose, 24 July 2012 - 06:15 PM.

Spoiler

#9 Mechaflash

Mechaflash

    Sons of Anarchy

  • Active Members
  • PipPipPipPipPipPip
  • 1,358 posts

Posted 24 July 2012 - 06:59 PM

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

AutoIt         
#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, 24 July 2012 - 07:00 PM.

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

#10 BrewManNH

BrewManNH

    באָבקעס מיט קודוצ׳ה

  • MVPs
  • 6,877 posts

Posted 24 July 2012 - 07:10 PM

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)"

How to ask questions the smart way!

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 editorGUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.

GUIToolTip UDF Demo - Demo script to show how to use the GUIToolTip UDF to create and use customized tooltips.

Posted Image


#11 guinness

guinness

    guinness

  • MVPs
  • 10,446 posts

Posted 24 July 2012 - 07:12 PM

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

Example List: _AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_DesktopDimensions()_DisplayPassword()_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()_GUISetIcon()_Icon_Clear()/_Icon_Set()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_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()_StringIsValid()_StringReplaceWholeWord()_StringStripChar()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()AutoIt SearchAutoIt3 PortableAutoItWinGetTitle()/AutoItWinSetTitle()CodingFileInstallrGeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIGetBkColor()LockFile()PasteBinSciTE JumpSignature CreatorWM_COPYDATAMore Examples...Updated: 11/04/2013


#12 Mechaflash

Mechaflash

    Sons of Anarchy

  • Active Members
  • PipPipPipPipPipPip
  • 1,358 posts

Posted 24 July 2012 - 07:24 PM

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, 24 July 2012 - 07:25 PM.

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

#13 guinness

guinness

    guinness

  • MVPs
  • 10,446 posts

Posted 24 July 2012 - 07:35 PM

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.

Example List: _AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_DesktopDimensions()_DisplayPassword()_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()_GUISetIcon()_Icon_Clear()/_Icon_Set()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_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()_StringIsValid()_StringReplaceWholeWord()_StringStripChar()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()AutoIt SearchAutoIt3 PortableAutoItWinGetTitle()/AutoItWinSetTitle()CodingFileInstallrGeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIGetBkColor()LockFile()PasteBinSciTE JumpSignature CreatorWM_COPYDATAMore Examples...Updated: 11/04/2013


#14 Mechaflash

Mechaflash

    Sons of Anarchy

  • Active Members
  • PipPipPipPipPipPip
  • 1,358 posts

Posted 24 July 2012 - 07:47 PM

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

#15 JLogan3o13

JLogan3o13

    Down to 98

  • MVPs
  • 2,114 posts

Posted 24 July 2012 - 08:03 PM

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.


Attached File  Enumerate Remote Apps.au3   1.97K   43 downloads
J.I spent 10 minutes reviewing code and thinking "What kind of drugs is this guy on?" before realizing it was something I wrote.My Scripts:Include Source with Compiled Script, Disk Maintenance for Windows XP, "Deal-A-Day" Sites, SCCM 2007 Front End, Windows Firewall UDF

#16 BrewManNH

BrewManNH

    באָבקעס מיט קודוצ׳ה

  • MVPs
  • 6,877 posts

Posted 24 July 2012 - 08:08 PM

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.

AutoIt         
#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

How to ask questions the smart way!

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 editorGUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.

GUIToolTip UDF Demo - Demo script to show how to use the GUIToolTip UDF to create and use customized tooltips.

Posted Image


#17 Mechaflash

Mechaflash

    Sons of Anarchy

  • Active Members
  • PipPipPipPipPipPip
  • 1,358 posts

Posted 24 July 2012 - 09:23 PM

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.

AutoIt         
#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, 25 July 2012 - 07:37 PM.

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

#18 VelvetElvis

VelvetElvis

    Adventurer

  • Active Members
  • PipPip
  • 135 posts

Posted 25 July 2012 - 11:13 AM

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?

#19 tes5884

tes5884

    Wayfarer

  • Active Members
  • Pip
  • 77 posts

Posted 25 July 2012 - 01:52 PM

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.

#20 VelvetElvis

VelvetElvis

    Adventurer

  • Active Members
  • PipPip
  • 135 posts

Posted 25 July 2012 - 05:54 PM

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


I've checked a couple of similar scripts in the forums, and they all have this same issue. :(




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users