Hallo zusammen
Ich mache gerade meine erste Gehversuche mit autoit.
Eckdaten: Das Programm sollte:
- Registryhive auslesen z.B HKEY_CURRENT_USER\Software\Test
- Ein Textfile auslesen, welches auch Registrywerte enthält
- Beides Vergleichen
- Alle Registrywerte löschen, welche nicht im Textfile enthalten sind
Normalerweise würde ich den Registryhive einfach löschen, und mit den gewünschten Werten abfüllen, das kommt aber hier nicht in Frage, weil theoretisch die Möglichkeit besteht, dass die Registry abgefragt wird, während alles gelöscht ist.
Als Anfänger komme ich leider nicht weit Aber ich habe im Forum schonmal entdeckt, wie ich einen gewünschten Hive in die Registry in ein Array lade, und wie ich die Werte aus einem Textfile in ein Array lade:
[autoit]#include <array.au3>
#include <File.au3>
; #### Registry in ein Array einlesen
Dim $arSubKey[1] = [0]
$i = 1
While 1
$subkey = RegEnumKey('HKEY_CURRENT_USER\Software\test', $i)
If @error Then ExitLoop
$arSubKey[0] += 1
ReDim $arSubKey[UBound($arSubKey)+1]
$arSubKey[UBound($arSubKey)-1] = $subkey
$i += 1
WEnd
;_ArrayDisplay($arSubKey)
; #### Zeilen in Textfile in ein Array einlesen
Local $aFile, $file = @ScriptDir & '\test.txt' ; der Dateipfad
_FileReadToArray($file, $aFile)
For $i = 1 To UBound($aFile) -1
Next
;_ArrayDisplay($aFile)
; #### Nun die beiden Arrays vergleichen
[/autoit][autoit][/autoit][autoit]; #### Werte in Registry löschen, die nicht im Textfile enthalten sind
[/autoit]Wie vergleiche ich nun zwei Arrays, und wie lösche ich dann die entsprechend die Registry?
Danke für eure Hilfe!