|
Hi,
This is the sample tree: Windows Registry Editor Version 5.00 [HKEY_CURRENT_USER\test] [HKEY_CURRENT_USER\test\NetWare] [HKEY_CURRENT_USER\test\Novell] [HKEY_CURRENT_USER\test\test2] [HKEY_CURRENT_USER\test\test2\Test4] "thepath2"="ccekle" [HKEY_CURRENT_USER\test\Test3] "ThePath"="Bozo" and this is my kix script(sorry for the french comments): ;============================================================================ ; EnumKeys.KIX = ; = ; Pour une clé donnée en paramètre via la valeur Key, = ; Enumère les sous-clé et leurs valeurs. = ;============================================================================ ;BREAK ON
;============================================================================ ; Démarrage du programme = ;============================================================================ IF $Key = 0 $Key = "HKEY_CURRENT_USER\test" CLS ; Clear screen Settitle("EnumKeys.kix, Programme de recherche dans la base de registre.") $StringToFind="test" ENDIF ;============================================================================ ; Premièrement, énumérer les sous-clés. = ;============================================================================ ;déclarations de variables locales ;============================================================================ DIM $Index, $SaveKey
;============================================================================ ;Initialisation de l'index = ;============================================================================ $Index = 0 $SubKey = EnumKey( $Key , $Index ) WHILE @ERROR = 0 $SaveKey = $Key $Key = $Key + "\" + $SubKey
? "-->" + $Key sleep 1 ;======================================================================== ; contrôle si la chaine recherche est contenu dans la sous-clé = ;======================================================================== $x=InStr($SubKey,$StringToFind) IF $x <> 0 $REP='N' ? "La chaîne recherchée " + $StringToFind + " se trouve dans la sous-clé." ? "Voulez-vous la supprimer?(O/N)" GET $REP IF $REP = 'O' ? "je la supprime et passe à la fin du programme sans scruter les sous-valeurs." $y = DelKey($Key) ? "Code retour de DelKey y= "+ $y If $y = 0 ? "Clé supprimée...." Endif ENDIF sleep 1 ENDIF
CALL "\\karma\m-kalkoul\Dev\KixTart\Scripts\FindKeys\Save\EnumKeys.kix" $Key = $SaveKey IF @ERROR = 0 ; try for next subkey $Index = $Index + 1 $SubKey = EnumKey( $Key , $Index ) ENDIF LOOP
;============================================================================ ; Enumération de toute les valeurs de la sous-clés = ;============================================================================ $Index = 0 $Value = EnumValue( $Key , $Index ) WHILE @ERROR = 0 ? $Key + "|" + $Value sleep 1
$Index = $Index + 1 $Value = EnumValue( $Key , $Index ) LOOP
;=========================FIN DU PROGRAMME=================================== :FIN ? "Fin du programme" sleep 2 EXIT 0 = ;============================================================================ results and problems: I'm looking for the "test" string, and when it find [HKEY_CURRENT_USER\test\test2] which has one subkey with a value with deltree function, it sends a return code equal to 5, and I know it's because it has a subkey because for every other subkey which has the string test, it can be deleted. Someone can say me why it doesn't work?
Thanks in advance for your help, Jaïd
|