Help - Search - Members
Full Version: how do I use ScriptKey in winapp2.ini?
Piriform Forums > Piriform Software > CCleaner Discussion
Camarofreak
I need info on how to use ScriptKey1.
Please someone give me a example file or something of how to use it biggrin.gif

Could I write a script to create a registry entry that increases # at end of key? (read next section below)
And adds it to winapp2.ini file?
does CCleaner read from the script file or does it run the script & the script writes entries to winapp2.ini ?


K I have made a winapp2.ini file.
I have programs like editpad pro & others that remember recently search history.
And it will make a new registry key for each search.
all of the search history folders need to be deleted but I'm not wanting to add 40 or 50 entries to winapp2.ini
it wont let me use hkcu\Software\JGsoft\EditPadPro6\SearchHistory* to get rid of all the keys

Search history
CODE
HKEY_CURRENT_USER\Software\JGsoft\EditPadPro6\SearchHistory

stores the number of searches also search & replace text.

And it also creates key to remember each searches options.
CODE
HKEY_CURRENT_USER\Software\JGsoft\EditPadPro6\SearchHistory0
HKEY_CURRENT_USER\Software\JGsoft\EditPadPro6\SearchHistory1

adds number each search & creates new key
.
.

Disk4mat
CC only executes the script you specify to run using the ini. Too bad those searchistory keys arent stored under a parent key that could be safely removed. Well you have two options. Either list nermous regkeys as you mentioned you didnt want to do. Or create a WSH to loop thru the keys until no more are found. I'll try and whip something up tonight based on the keys you provided.
Disk4mat
Ok here is a scipt. In the ZIP file you'll find: JGSoft.vbs and WinApp2.ini. The ini file is for reference. Dont overwrite your existing one. Just copy and paste the non-commented section.

Here is the script and ini entry...

Script. Place JGSoft.vbs from the ZIP into the same folder as CCleaner.exe
CODE
Const HKCU = &H80000001
Set WS = CreateObject("WScript.Shell")

strComputer = "."
Set objRegistry = GetObject("winmgmts:\\" & strComputer & "\root\default:StdRegProv")

strKeyPath = "Software\JGsoft\EditPadPro6"
strKeyName = "SearchHistory"

objRegistry.EnumKey HKCU, strKeyPath, arrValueNames

For i = 0 to UBound(arrValueNames)
    strValueName = arrValueNames(i)

If InStr(UCase(strValueName), UCase(strKeyName)) > 0 Then
     WS.RegDelete "HKEY_CURRENT_USER\" & strKeyPath & "\" & strValueName & "\"
End if

Next

Set WS = Nothing
WScript.Quit


INI Entry copy and paste into your winapp2.ini
CODE
[JGsoft EditPad]
LangSecRef=3024
Detect=HKCU\Software\JGsoft\EditPadPro6
Default=True
ScriptKey1=JGSoft.vbs


The script will delete every key named SearchHistory. This includes any numeric variations. I recreated all the keys visible in your screenshot and tested it. Works perfectly deleteing SearchHistory, SearchHistory0, SearchHistory1 etc. The script uses a simple find keys containing 'SearchHistory'. So for example SearchFavorites wont be removed.

ZIP file: Click to view attachment
Camarofreak
QUOTE
The script will delete every key named SearchHistory. This includes any numeric variations. I recreated all the keys visible in your screenshot and tested it. Works perfectly deleteing SearchHistory, SearchHistory0, SearchHistory1 etc. The script uses a simple find keys containing 'SearchHistory'. So for example SearchFavorites wont be removed.


biggrin.gif cool thanks I tried it out & it works great.

Thanks a lot man.
Disk4mat
Your welcome! This gave me a chance to explore some possiblities when combining WSH and CC.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2008 Invision Power Services, Inc.