Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate

Add-Remove Editor


  • Please log in to reply
7 replies to this topic
jaco0646
  • Guests
  • Last active:
  • Joined: --
After reading this article about how the Add/Remove Programs control panel gets its information, I wrote a script to edit a few of the fields. I'm sure most people could care less about what ARP says because they rarely use it; but since someone might find it useful, I'll post the script.
#SingleInstance force

#NoTrayIcon

Keys = Software\Microsoft\Windows\CurrentVersion\Uninstall

RegRead, 8dot3, HKLM, SYSTEM\CurrentControlSet\Control\FileSystem

, NtfsDisable8dot3NameCreation

Gui, Add, Button, gPics, Find Picts

Gui, Add, Button, gSave ys, Save Names

Gui, Add, Pic, gCPL x+30 ys Icon163, %A_WinDir%\System32\Shell32.dll

Gui, Add, Button, gSize x+30 ys, Find Sizes

Gui, Add, DDL, ys w65 vPick gUse, frequently|occasionally|rarely|blank

Gui, Add, ListView

, xs w385 h560 Grid Sort -ReadOnly -Multi gEvent, Name|Key|Size(MB)|Use

ID := IL_Create(40)

LV_SetImageList(ID, 1)

Loop, HKLM, %Keys%, 2

{

 StringLeft, Cut, A_LoopRegName, 2

 If Cut = KB

  continue

 RegRead, Name, HKLM, %Keys%\%A_LoopRegName%, DisplayName

 If Name = 

  continue

 RegRead, Icon, HKLM, %Keys%\%A_LoopRegName%, DisplayIcon

 If Icon = 

  ILNumber = 999

 Else If (8dot3 = 1) AND (InStr(Icon, "~") != 0)

  ILNumber := IL_Add(ID, A_WinDir "\System32\Shell32.dll", 132)

 Else

 {

  StringRight, Cut, Icon, 1

  If Cut is integer

  {

   StringSplit, Icon, Icon, `,

   If Icon0 between 1 and 2

    ILNumber := IL_Add(ID, Icon1, Icon2)

   Else ILNumber := IL_Add(ID, A_WinDir "\System32\Shell32.dll", 132)

  }

  Else ILNumber := IL_Add(ID, Icon)

 }

 GetSize(A_LoopRegName)

 GetUse(A_LoopRegName)

 If Use = FF

  Use = 

 Else

 {

  Use = 0x%Use%

  If Use < 3

   Use = rarely

  Else If Use < 11

   Use = occasionally

  Else If Use > 10

   Use = frequently

 }

 LV_Add("Icon" ILNumber, Name, A_LoopRegName, Size, Use)

}

LV_ModifyCol()

LV_ModifyCol(2,0)

LV_ModifyCol(3, "Float")

Gui, Show,, Add-Remove Editor

return

GuiClose:

ExitApp

;

;#################

;#g-Labels: Pics##

;#################

;

Pics:

Selection := GetSel()

LV_GetText(SubKey, Selection, 2)

LV_GetText(Name, Selection)

RegRead, Dir, HKLM, %Keys%\%SubKey%, InstallLocation

If Dir = 

 Dir := A_ProgramFiles

Gui, +OwnDialogs

FileSelectFile, Pick, 3, %Dir%, Select the executable for %Name%

, Programs (*.exe)

If Pick = 

 return

RegWrite, REG_SZ, HKLM, %Keys%\%SubKey%, DisplayIcon, %Pick%

LV_GetText(Size, Selection, 3)

If Size = 

{

 FileGetSize, Size, %Pick%, K

 SetFormat, Float, 0.2

 Size := Size/1024

 WriteSize(SubKey, Size)

}

Run, %A_ScriptFullPath%

return

;

;#################

;#g-Labels: Save##

;#################

;

Save:

i = 0

Loop % LV_GetCount()

{

 LV_GetText(Selection, A_Index)

 LV_GetText(SubKey, A_Index, 2)

 RegRead, Name, HKLM, %Keys%\%SubKey%, DisplayName

 If Selection != %Name%

 {

  RegWrite, REG_SZ, HKLM, %Keys%\%SubKey%, DisplayName, %Selection%

  i++

 }

}

Gui, +OwnDialogs

MsgBox, 4160, Add-Remove Editor, %i% changes have been saved.

return

;

;#################

;#g-Labels: CPL###

;#################

;

CPL:

Run, appwiz.cpl

return

;

;#################

;#g-Labels: Size##

;#################

;

Size:

Selection := GetSel()

LV_GetText(SubKey, Selection, 2)

LV_GetText(Name, Selection)

Gui, +OwnDialogs

FileSelectFolder, NewDir, *%A_ProgramFiles%, 0

, Select the installation folder for %Name%

If NewDir = 

 return

RegRead, Dir, HKLM, %Keys%\%SubKey%, InstallLocation

If Dir != %NewDir%\

 RegWrite, REG_SZ, HKLM, %Keys%\%SubKey%, InstallLocation, %NewDir%\

Size = 0

Loop, %NewDir%\*.*,,1

 Size += %A_LoopFileSizeKB%

SetFormat, Float, 0.2

Size := Size/1024

LV_Modify(Selection, "Col3", Size)

WriteSize(SubKey, Size)

return

;

;#################

;#g-Labels: Use###

;#################

;

Use:

Selection := GetSel()

Gui, Submit, NoHide

LV_GetText(SubKey, Selection, 2)

GetUse(SubKey)

If Pick = frequently

 Use = 1E000000

Else If Pick = occasionally

 Use = 06000000

Else If Pick = rarely

 Use = 01000000

Else If Pick = blank

 Use = FFFFFFFF

SIC = %Begin%%Use%%End%

StringLen, Count, SIC

If Count = 1104

{

 RegWrite, REG_BINARY, HKLM

 , SOFTWARE\Microsoft\Windows\CurrentVersion\App Management\ARPCache\%SubKey%

 , SlowInfoCache, %SIC%

}

LV_Modify(Selection, "Col4", Pick)

return

;

;#################

;#g-Labels: Click#

;#################

;

Event:

If A_GuiEvent = DoubleClick

{

 LV_GetText(SubKey, A_EventInfo, 2)

 RegWrite, REG_SZ, HKCU, Software\Microsoft\Windows\CurrentVersion\Applets\Regedit

 , LastKey, My Computer\HKEY_LOCAL_MACHINE\%Keys%\%SubKey%

 Run, regedit

}

return

;

;#################

;#Functions: Use##

;#################

;

GetUse(SubKey)

{

 global

 RegRead, SIC, HKLM

 , SOFTWARE\Microsoft\Windows\CurrentVersion\App Management\ARPCache\%SubKey%

 , SlowInfoCache

 StringLeft, Begin, SIC, 48

 StringMid, Use, SIC, 49, 2

 StringRight, End, SIC, 1048

}

;

;#################

;#Functions: Sel##

;#################

;

GetSel()

{

 Selection := LV_GetNext()

 If Selection = 0

 {

  Gui, +OwnDialogs

  MsgBox, 4144, Add-Remove Editor, Please select a row.

  Exit

 }

 return, Selection

}

;

;#################

;#Functions: Size#

;#################

;

GetSize(SubKey)

{

 global

 RegRead, SIC, HKLM

 , SOFTWARE\Microsoft\Windows\CurrentVersion\App Management\ARPCache\%SubKey%

 , SlowInfoCache

 StringLeft, Begin, SIC, 18

 StringRight, End, SIC, 1080

 StringMid, Size, SIC, 19, 6

 If Size = FFFFFF

  Size = 

 Else

 {

  StringMid, B, Size, 5, 2

  StringMid, C, Size, 3, 1

  StringMid, D, Size, 4, 1

  StringMid, E, Size, 1, 1

  Int := "0x" B C

  Int += 0

  SetFormat, Float

  Dec1 := "0x" D

  Dec1 *= 6.25

  Dec2 := "0x" E

  Dec2 *= 0.39

  If Dec1 = 0

   Dec1 = 0%Dec2%

  Else Dec1 := Dec1+Dec2

  Size := Int "." Dec1

 }

}

;

;#################

;#Functions:Write#

;#################

;

WriteSize(SubKey, MB)

{

 RegRead, SIC, HKLM

 , SOFTWARE\Microsoft\Windows\CurrentVersion\App Management\ARPCache\%SubKey%

 , SlowInfoCache

 StringLeft, Begin, SIC, 16

 StringRight, End, SIC, 1072

 StringSplit, MB, MB, .

 If MB0 > 2

  Exit

 SetFormat, Integer, Hex

 MB1 += 0

 If MB0 = 1

  MB2 = 0x00

 Else

 {

  StringLen, Count, MB2

  If Count > 2

   StringLeft, MB2, MB2, 2

  Else If Count = 1

   MB2 = %MB2%0

  D := Floor(MB2/6.25)

  E := Floor(Ceil(MB2-D*6.25)/.39)

 }

 StringTrimLeft, MB1, MB1, 2

 StringTrimLeft, D, D, 2

 StringTrimLeft, E, E, 2

 StringLen, Count, MB1

 If Count = 1

  MB1 = 00%MB1%

 Else If Count = 2

  MB1 = 0%MB1%

 StringMid, B, MB1, 1, 2

 StringMid, C, MB1, 3, 1

 Size := "00" E "0" C D B "00000000"

 SIC = %Begin%%Size%%End%

 StringLen, Count, SIC

 If Count != 1104

 {

  Gui, +OwnDialogs

  MsgBox, 4144, Add-Remove Editor, SIC count != 1104.

  Exit

 }

 RegWrite, REG_BINARY, HKLM

 , SOFTWARE\Microsoft\Windows\CurrentVersion\App Management\ARPCache\%SubKey%

 , SlowInfoCache, %SIC%

}


SKAN
  • Administrators
  • 9115 posts
  • Last active:
  • Joined: 26 Dec 2005
Dear jaco0646, :)

Nice! :shock: :D
Your script gives me many ideas..
Thanks for sharing this ..

Regards, :)

PS: Howcome you decided to post a GUI Script without a snapshot :?: :!:

Let mine be here until you post one :)

Posted Image
kWo4Lk1.png

jaco0646
  • Moderators
  • 3165 posts
  • Last active: Apr 01 2014 01:46 AM
  • Joined: 07 Oct 2006
I'm glad someone found it useful! I completely forgot to include a picture with it, oops. It should have the little ARP icon at the top, so the script must not have found the Shell32.dll file on your PC. I should have mentioned that this script has only been tested with Windows XP, and a couple lines may need to be changed to comply with other operating systems.

Posted Image

Edit: I've tweaked the code a bit since the original. The newest version will always be found here.

user
  • Members
  • 476 posts
  • Last active: Dec 23 2011 07:18 PM
  • Joined: 05 Oct 2006
nice thanks!!!

Andreone
  • Members
  • 257 posts
  • Last active: Mar 19 2008 05:30 PM
  • Joined: 20 Jul 2007
Thanks for sharing, it's a good start for making full add-remove program manager, like this one MyUninstaller
I don't see the Size & Use columns :(

user
  • Members
  • 476 posts
  • Last active: Dec 23 2011 07:18 PM
  • Joined: 05 Oct 2006
http://wistinga.online.fr/safarp/ much better than myuninstaller, but a bit slow...

Andreone
  • Members
  • 257 posts
  • Last active: Mar 19 2008 05:30 PM
  • Joined: 20 Jul 2007
I have given a look at safarp, and its quite nice.
However, one thing I like with MyUninstaller is that its a single exe, as much of Nir Sofer softwares.
Also, I don't why you say much better than MyUninstaller? They have more or less the same features. I might have miss something though.

XYZ
  • Members
  • 224 posts
  • Last active: Apr 29 2010 01:48 PM
  • Joined: 20 Mar 2010
thx i needed this info for my project :p