tresa Posted October 15, 2006 Posted October 15, 2006 (edited) Oh thanks. Maybe also you can clean: This works OK Why not func inicheck($n,$max) If IniRead("batUSB_CONFIG.ini","PROGRAMS","Count","0") > $n Then If IniRead("batUSB_CONFIG.ini","PROGRAMS",$n+1 & ".Mode","") = 0 OR IniRead("batUSB_CONFIG.ini","PROGRAMS",$n+1 & ".Mode","") = 1 Then Run(IniRead("batUSB_CONFIG.ini","PROGRAMS",$n+1 & ".ProgramPath","") & " " & IniRead("batUSB_CONFIG.ini","PROGRAMS",$n+1 & ".Switch","")) if $n<$max then inicheck($n+1,$max) EndIf EndIf EndFunc func iniCheck2($n,$max) If IniRead("batUSB_CONFIG.ini","REGISTRY","Count","0") > $n Then _ssBackup(($n+1) & ".Name",($n+1) & ".Key") RegDelete (IniRead("batUSB_CONFIG.ini","REGISTRY",($n+1) & ".Key","")) _ssRegFAdd(IniRead("batUSB_CONFIG.ini","REGISTRY",($n+1) & ".Name","")) if $n<$max then iniCheck2($n+1,$max) EndIf EndFunc Func OnAutoItStart ( ) inicheck(0,9) iniCheck2(0,9) EndFunc Edited October 15, 2006 by tresa
tresa Posted October 15, 2006 Posted October 15, 2006 (edited) Something is wrong in func cleanUp($n). I have info that variable $ssFName used without being declared.here i modified the code Func _sRegBackup($ssFName,$KEYEND) Local $regkeybs = IniRead("batUSB_CONFIG.ini", "REGISTRY", $KEYEND, "") Local $srege = @WindowsDir & "\regedit.exe /a " & Chr("34") & $regfolder & "\" & $ssFName & "1.reg" & Chr("34") & " " & IniRead("batUSB_CONFIG.ini", "REGISTRY", $KEYEND, "") Local $sregbackups = @WindowsDir & "\regedit.exe /s " & Chr("34") & $regfolder & "\backup_" & $ssFName & ".reg" & Chr("34") Local $sregbackupe = @WindowsDir & "\regedit.exe /a " & Chr("34") & $regfolder & "\backup_" & $ssFName & ".reg" & Chr("34") & " " & IniRead("batUSB_CONFIG.ini", "REGISTRY", $KEYEND, "") Local $n for $n=5 to 1 step-1 If FileExists($regfolder & "\" & $ssFName & $n & ".reg") then ExitLoop next if $n>0 then cleanUp($n,$ssFName ) RunWait ($srege, $regfolder, @SW_HIDE ) RegDelete($regkeybs) RunWait ($sregbackups, $regfolder, @SW_HIDE ) FileDelete ($regfolder & "\backup_" & $ssFName & ".reg" ) EndIf EndFunc func cleanUp($n,$fnName) FileMove($regfolder & "\" & $fnName& $n & ".reg", $regfolder & "\" & $fnName & ($n+1) & ".reg") if $n=1 then return FileDelete ($regfolder & "\" & $fnName& $n & ".reg" ) cleanUp($n-1) EndFunc Edited October 15, 2006 by tresa
tresa Posted October 15, 2006 Posted October 15, 2006 and one more:I know looks ugly I' ve worked twice, try yourself now!Good luck !
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now