Sign in to follow this  
Followers 0
SebaM

How replace some strings in registry file

23 posts in this topic

I want to change some of registry file entries to be more mobile. For example I have in registry file such a string:

"Working Directory"="Z:\\The Bat!\\MailTok\\"

"ProgramDirRelative"="%PROGRAMDIR%\\"

"ProgramDir"="Z:\\The Bat!\\"

"EXE pathRelative"="%PROGRAMDIR%\\thebat.exe"

"EXE path"="Z:\\The Bat!\\thebat.exe"

and want to automaticaly change drive letter to current one. Is this possible? I try to do this:

$tbregfileread = FileOpen($regfolder & "\tb1.reg", 0)

$readed = FileRead ( $tbregfileread )

$text = StringReplace($readed, '"Working Directory"="' & [A-Z] &":", @WorkingDir)

but I have problem with searchstring. After replece registry file must be saved to disk.

Please help me.

Share this post


Link to post
Share on other sites



To use strings on a .reg file, it must be ASCII, not Unicode. Open a ASCII .reg file and search and replace. To open Unicode file, fileopen(file,4) - which is RAW, or hexadecimal. Then handle with something like _Hex2String, then you can use strings to search and replace.

Local $TempFile = FileOpen($REG,4)
$Rread = StringReplace(String(FileRead($TempFile,FileGetSize($REG))),"0x","")

$Rread now has entire hexadecimal file. Use StringSplit or something to get it into pieces to do more work with.

Sul

Share this post


Link to post
Share on other sites

Oh my good. I think that this is more easy. Im not Informatiker so for me I think is too much :lmao:

There is no easy way to replace in registry file drive letters? Just simple find and replace? Maybe not to change in registry file but write this file to registry and then change entry to current drive letter or working directory?

Share this post


Link to post
Share on other sites

It is easy, if the .reg file is ASCII. Then you can open file, read line, search for c:\ and replace with d:\. All pretty standard stuff you will find in the help file examples, under fileopen, filereadline,stringinstr,stringreplace.

Most people export .reg file in w2k/xp format, which is Unicode. Exporting in 9x is ASCII. You can also find mulitple posts showing how to use a RunWait(@comspec 'type') statement to convert the existing Unicode format to ASCII format.

You can also use the RegRead and RegWrite functions to chage the values in your registry.

later,

Sul

Share this post


Link to post
Share on other sites

To export regfiles I use this:

RunWait (regedit.exe /e regs\backup.reg, @WorkingDir, @SW_HIDE )

When I look to this file in txt editor it is no matter if encoding is utf-8 or win-1250. All characters are readable also in us-ascii. System: winXP sp2

Can you write me example how to find only this:

"Working Directory"="Z:\\The Bat!\\MailTok\\"

and replace to:

"Working Directory"="CURRENT_DRIVE_LETTER"

This can be my template.

Share this post


Link to post
Share on other sites

Maybe something like this, although I did not try it.

#include <file.au3>
$fileout = FileOpen("your save location",2)
$file = FileOpen("your file location",0)
While 1
    $line = FileReadLine($file)
    If @error = -1 Then ExitLoop
    If StringInStr($line,'"Working Directory"="Z:\\The Bat!\\MailTok\\"') Then _
        $line = StringReplace($line,'"Working Directory"="Z:\\The Bat!\\MailTok\\"','"Working Directory"="' _
        & @HomeDrive & '\"')
    FileWriteLine($fileout,$line)
WEnd
FileClose($fileout)
FileClose($file)

There are other ways to do this, but this will give you an idea of how to walk through a file line by line.

later,

Sul

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

I try something like this:

$file = FileOpen($regfolder & "\tb1.reg", 0)

; Check if file opened for reading OK
If $file = -1 Then
    MsgBox(0, "Error", "Unable to open file.")
    Exit
EndIf

; Read in lines of text until the EOF is reached
While 1
    $line = FileReadLine($file)
    If @error = -1 Then ExitLoop
    MsgBox(0, "Line read:", $line)
Wend

FileClose($file)
$text = StringRegExpReplace($line, '\"Working\sDirectory\"\="[A-Z|a-z]\:\\\\', @WorkingDir)
MsgBox(0, "Error", $text)

but I think that AutoIt don't support regexps? MessageBox don't show changed directory.

Thans for all help.

Edited by SebaM

Share this post


Link to post
Share on other sites

I try something like this:

$file = FileOpen($regfolder & "\tb1.reg", 0)

; Check if file opened for reading OK
If $file = -1 Then
    MsgBox(0, "Error", "Unable to open file.")
    Exit
EndIf

; Read in lines of text until the EOF is reached
While 1
    $line = FileReadLine($file)
    If @error = -1 Then ExitLoop
    MsgBox(0, "Line read:", $line)
Wend

FileClose($file)
$text = StringRegExpReplace($line, '\"Working\sDirectory\"\="[A-Z|a-z]\:\\\\', @WorkingDir)
MsgBox(0, "Error", $text)

but I think that AutoIt don't support regexps? MessageBox don't show changed directory.

Thans for all help.

If your file is opened, you then read $line. If there is only one line in the file, then you have captured $line. However, if there is more than one line in the file, then your RegExp is looking for whatever the last $line was, which may not contain what you expect. Try doing a string search before the wend.

Sul

Share this post


Link to post
Share on other sites

$fileout = FileOpen($regfolder & "\tb1a.reg",2)
$file = FileOpen($regfolder & "\tb1.reg",0)
While 1
    $line = FileReadLine($file)
    If @error = -1 Then ExitLoop
    If StringInStr($line,'"Working Directory"="Z:\\The Bat!\\MailTok\\"') Then _
        $line = StringRegExpReplace($line,'\"Working\sDirectory\"\="[A-Z|a-z]\:\\\\.*','"Working Directory"="' _
        & @HomeDrive & '\"')
    ;MsgBox(0, "Line read:", $line)
    FileWriteLine($fileout,$line)
WEnd
FileClose($fileout)
FileClose($file)

Now when I have code like this, replaced is OK but not with:

'"Working Directory"="' & @HomeDrive & '\"'

but with

2

Dont know why. Any advice?

Share this post


Link to post
Share on other sites

#11 ·  Posted (edited)

First guess would be the value has both ' and ", so the search is probably confused. Try you search string including the quotes that will be in the value. You might also give @Homedrive a $var before you call it. Then use the $var where you need it.

Sul

Edited by sulfurious

Share this post


Link to post
Share on other sites

Full script but not work.

#include <file.au3>
;
; AutoIt Version: 3.1
; Language:       English
; Platform:       Win9x/NT
; Author:         Sebastian Murawski (sebastian.murawski@gmail.com)
;
; Script Function:
;   The Bat at USB pen.
;
; Predefiniowane zmienne
$PID = ProcessExists("thebat.exe")
$regfolder = @WorkingDir & "\regs"
$regkey = "HKEY_LOCAL_MACHINE\SOFTWARE\RIT"
$SWITCH = IniRead("batUSB_CONFIG.ini", "GENERAL", "Parameters", "")
$tbrun = "thebat.exe " & $SWITCH
;===============================================================================
;
; Description:      Plik mobilnego TB w folderze głównym TB
; Syntax:           _TbFindFile
; Parameter(s):     $sString      - String to change to proper case.
; Requirement(s):   None
; Return Value(s):  On Success - Returns the proper string.
;                   On Failure - Returns an empty string and sets @error = 1
; Author(s):        Sebastian Murawski <mailto:sebastian.murawski@gmail.com>
; Note(s):          None
;
;===============================================================================
Func _sBackup($sFbName)
; backup istniejącego rejestru
    Local $message = "Backupuje istniejące wpisy rejestru"
    Local $regbackupes = @WindowsDir & "\regedit.exe /e regs\backup_" & $sFbName & ".reg " & $regkey
    SplashTextOn("Bat@USB InfoBox", $message, 400, 20, -1, -1, 32, "Tahoma", 10)
    Sleep(500)
    RunWait ($regbackupes, @WorkingDir, @SW_HIDE )
            RegDelete($regkey)
EndFunc
;===============================================================================
;
; Description:      Plik mobilnego TB w folderze głównym TB
; Syntax:           _TbFindFile
; Parameter(s):     $sString      - String to change to proper case.
; Requirement(s):   None
; Return Value(s):  On Success - Returns the proper string.
;                   On Failure - Returns an empty string and sets @error = 1
; Author(s):        Sebastian Murawski <mailto:sebastian.murawski@gmail.com>
; Note(s):          None
;
;===============================================================================
Func _sRegFAdd($sFileName)
    Local $regtb1s = @WindowsDir & "\regedit.exe /s regs\" & $sFileName & "1.reg"
; dodajemy do rejestru info o mobilnej wersji TB
    Local $message = "Eksportuje do rejestru wpisy mobilnego The Bat!"
    ControlSetText("Bat@USB InfoBox", "", "Static1", $message)
    Sleep(500)
; dodajemy do rejestru info o mobilnej wersji TB
    RunWait ($regtb1s, $regfolder, @SW_HIDE )
EndFunc

;===============================================================================
;
; Description:      Plik mobilnego TB w folderze głównym TB
; Syntax:           _TbFindFile
; Parameter(s):     $sString      - String to change to proper case.
; Requirement(s):   None
; Return Value(s):  On Success - Returns the proper string.
;                   On Failure - Returns an empty string and sets @error = 1
; Author(s):        Sebastian Murawski <mailto:sebastian.murawski@gmail.com>
; Note(s):          None
;
;===============================================================================
Func _TbFindFile()
    Local $tbloc = FileExists(@WorkingDir & "\thebat.exe")
If $tbloc = 0 Then
        SplashTextOn("Wystąpił błąd podczas uruchamiania", "Plik startowy Bat@USB nie znajduje się w folderze instalacyjnym The Bat!." & @LF & "Proszę przegrać plik startowy Bat@USB do folderu instalacyjnego programu The Bat!" & @LF & "a następnie ponownie uruchomić program.", 600, 100, -1, -1, 32, "Tahoma", 10)
    Sleep(5000)
    SplashOff()
    Exit
EndIf
EndFunc
;===============================================================================
;
; Description:      Zmiana plików rejestru
; Syntax:           _RegBackup($sFName)
; Parameter(s):     $sString      - String to change to proper case.
; Requirement(s):   None
; Return Value(s):  On Success - Returns the proper string.
;                   On Failure - Returns an empty string and sets @error = 1
; Author(s):        Sebastian Murawski <mailto:sebastian.murawski@gmail.com>
; Note(s):          None
;
;===============================================================================
Func _RegBackup($sFName)
    Local $regtb1e = @WindowsDir & "\regedit.exe /e regs\" & $sFName & "1.reg " & $regkey
    Local $regbackups = @WindowsDir & "\regedit.exe /s regs\backup_" & $sFName & ".reg"
    Local $regbackupe = @WindowsDir & "\regedit.exe /e regs\backup_" & $sFName & ".reg " & $regkey

; backup istniejącego rejestru
;   RunWait ($regbackupe, $regfolder, @SW_HIDE )
        If FileExists($regfolder & "\" & $sFName & "5.reg") Then
            FileDelete ($regfolder & "\" & $sFName & "5.reg" )
            FileMove($regfolder & "\" & $sFName & "4.reg", $regfolder & "\" & $sFName & "5.reg")
            FileDelete ($regfolder & "\tb4.reg" )
            FileMove($regfolder & "\" & $sFName & "3.reg", $regfolder & "\" & $sFName & "4.reg")
            FileDelete ($regfolder & "\" & $sFName & "3.reg" )
            FileMove($regfolder & "\" & $sFName & "2.reg", $regfolder & "\" & $sFName & "3.reg")
            FileDelete ($regfolder & "\" & $sFName & "2.reg" )
            FileMove($regfolder & "\" & $sFName & "1.reg", $regfolder & "\" & $sFName & "2.reg")
            RunWait($regtb1e, @WorkingDir, @SW_HIDE )
            RegDelete($regkey)
            RunWait($regbackups, @WorkingDir, @SW_HIDE )
            FileDelete ($regfolder & "\backup_" & $sFName & ".reg" )
        Else
    If FileExists($regfolder & "\" & $sFName & "4.reg") Then
        FileMove($regfolder & "\" & $sFName & "4.reg", $regfolder & "\" & $sFName & "5.reg")
        FileDelete ($regfolder & "\" & $sFName & "4.reg" )
        FileMove($regfolder & "\" & $sFName & "3.reg", $regfolder & "\" & $sFName & "4.reg")
        FileDelete ($regfolder & "\" & $sFName & "3.reg" )
        FileMove($regfolder & "\" & $sFName & "2.reg", $regfolder & "\" & $sFName & "3.reg")
        FileDelete ($regfolder & "\" & $sFName & "2.reg" )
        FileMove($regfolder & "\" & $sFName & "1.reg", $regfolder & "\" & $sFName & "2.reg")
        RunWait ($regtb1e, @WorkingDir, @SW_HIDE )
            RegDelete($regkey)
        RunWait ($regbackups, @WorkingDir, @SW_HIDE )
        FileDelete ($regfolder & "\backup_" & $sFName ".reg" )
    Else
    If FileExists($regfolder & "\" & $sFName & "3.reg") Then
        FileMove($regfolder & "\" & $sFName & "3.reg", $regfolder & "\" & $sFName & "4.reg")
        FileDelete ($regfolder & "\" & $sFName & "3.reg" )
        FileMove($regfolder & "\" & $sFName & "2.reg", $regfolder & "\" & $sFName & "3.reg")
        FileDelete ($regfolder & "\" & $sFName & "2.reg" )
        FileMove($regfolder & "\" & $sFName & "1.reg", $regfolder & "\" & $sFName & "2.reg")
        RunWait ($regtb1e, @WorkingDir, @SW_HIDE )
            RegDelete($regkey)
        RunWait ($regbackups, @WorkingDir, @SW_HIDE )
        FileDelete ($regfolder & "\backup_" & $sFName ".reg" )
    Else
    If FileExists($regfolder & "\" & $sFName & "2.reg") Then
        FileMove($regfolder & "\" & $sFName & "2.reg", $regfolder & "\" & $sFName & "3.reg")
        FileDelete ($regfolder & "\" & $sFName & "2.reg" )
        FileMove($regfolder & "\" & $sFName & "1.reg", $regfolder & "\" & $sFName & "2.reg")
        RunWait ($regtb1e, @WorkingDir, @SW_HIDE )
            RegDelete($regkey)
        RunWait ($regbackups, @WorkingDir, @SW_HIDE )
        FileDelete ($regfolder & "\backup_" & $sFName & ".reg" )
    Else
    If FileExists($regfolder & "\" & $sFName & "1.reg") Then
        FileMove($regfolder & "\" & $sFName & "1.reg", $regfolder & "\" & $sFName & "2.reg")
        RunWait ($regtb1e, @WorkingDir, @SW_HIDE )
            RegDelete($regkey)
        RunWait ($regbackups, @WorkingDir, @SW_HIDE )
        FileDelete ($regfolder & "\backup_" & $sFName & ".reg" )
    EndIf
    EndIf
    EndIf
    EndIf
EndIf
EndFunc
;===============================================================================
;
; Description:      Changes string in regfiles
; Syntax:           _RegFChange($sString, $sFrom, $sTo, $sFileOut)
; Parameter(s):     $sString      - String to change to proper case.
; Requirement(s):   None
; Return Value(s):  On Success - Returns the proper string.
;                   On Failure - Returns an empty string and sets @error = 1
; Author(s):        Sebastian Murawski <mailto:sebastian.murawski@gmail.com>
; Note(s):          None
;
;===============================================================================
Func _RegFChange($sString, $sFrom, $sTo, $sFileOut)
    Local $fileoutpath = $regfolder & "\" & $sFileOut & "a.reg"
    Local $filepath = $regfolder & "\" & $sFileOut & ".reg"
    Local $fileout = FileOpen($regfolder & "\" & $sFileOut & "a.reg",2)
    Local $file = FileOpen($regfolder & "\" & $sFileOut & ".reg",0)
;   Local $compar = StringInStr(FileReadLine($file),$sString)
;   If $compar <> 0 Then
        While 1
                $line = FileReadLine($file)
                    If @error = -1 Then ExitLoop
                    If StringInStr($line,$sString) Then _
                    $line = StringRegExpReplace($line,$sFrom,$sTo)
                ;MsgBox(0, "Line read:", $line)
                    FileWriteLine($fileout,$line)
        WEnd
    FileClose($fileout)
    FileClose($file)
    FileMove($fileoutpath,$filepath,9)
    FileDelete($fileoutpath)
;   EndIf
EndFunc   ;==>_RegFChange

_TbFindFile()

; jeżeli istnieje proces thebat to nalezy wywolac okno z pytaniem czy uruchamiamy thebatamobilnego. a nastepnie wedlug odpowiedzi albo zamykamy proces albo konczymy dzialanie skryptu. Jezeli zamykamy proces to backupujemy ostatnie dane i otwieramy mobilnego bacika.

If $PID <> 0 Then
        $MSG = MsgBox(4100, "Uwaga!", "Na komputerze jest uruchomiona inna instalacja programu The Bat!. Naciśnij TAK jeżeli chcesz zamknąć inny proces The Bat! i uruchomić wersję mobilną. Wybór NIE spowoduje anulowanie uruchamiania Bat@USB.")
        If $MSG = 7 Then
            Exit
        Else
            WinClose("The Bat!", "")
            WinWaitClose("The Bat!")
;           ProcessWaitClose("$PID")

; backup istniejącego rejestru
_sBackup("tb")

; obrabiamy plik rejestru przystosowując wybrane wartości
            _RegFChange('"Working Directory"="Z:\\The Bat!\\MailTok\\"','\"Working\sDirectory\"\="[A-Z|a-z]\:\\\\.*','"Working Directory"="' & @HomeDrive & '\"',"tb1")
; dodajemy do rejestru info o mobilnej wersji TB
_sRegFAdd("tb")
; uruchamiamy mobilną wersję TB
    $message = "Uruchamiam mobilnego The Bat!"
    ControlSetText("Bat@USB InfoBox", "", "Static1", $message)
    Sleep(500)
    RunWait ($tbrun, @WorkingDir, @SW_HIDE )
    SplashOff()
; backupujemy rejestr mobilnego TB na zakończenie pracy z programem
        _RegBackup("tb")
        EndIf
EndIf

If $PID = 0 Then
; backup istniejącego rejestru
_sBackup("tb")

; obrabiamy plik rejestru przystosowując wybrane wartości
    _RegFChange('"Working Directory"="Z:\\The Bat!\\MailTok\\"','\"Working\sDirectory\"\="[A-Z|a-z]\:\\\\.*','"Working Directory"="' & @HomeDrive & '\"','tb1')

; dodajemy do rejestru info o mobilnej wersji TB
_sRegFAdd("tb")

; uruchamiamy mobilną wersję TB
    $message = "Uruchamiam mobilnego The Bat!"
    ControlSetText("Bat@USB InfoBox", "", "Static1", $message)
    Sleep(500)
    RunWait ($tbrun, @WorkingDir, @SW_HIDE )
    SplashOff()
; backupujemy rejestr mobilnego TB na zakończenie pracy z programem
    _RegBackup("tb")
EndIf

Problem is thet not create at the end tb1.reg just rename tb1.reg to tb2.reg but then not export registry to tb1.reg.

At start not create tb_backup file and dont know why.

Share this post


Link to post
Share on other sites

I will look up the regexp functions and play with it tonight. Prolly one of the more experienced will spot it right away tho.

Sul

Share this post


Link to post
Share on other sites

I don't know if you need to use regular expressions or not. If your drive letter value to change will always be the same, then I came up with this (as an example) to get the reg values, convert them to ascii, and then replace a value. Maybe it helps.

#include <file.au3>
#include <string.au3>
RunWait(@ComSpec & " /c reg export Hkey_Local_Machine\SOFTWARE\aaa c:\a.reg | type c:\a.reg > c:\tb1.reg | del c:\a.reg")
_RegChange('"NV Hostname"="e:\bob"', "tb1")
Func _RegChange($sString,$fName)
    Local $tmpFile = _TempFile()
    Local $fo = FileOpen($tmpFile,2)
    Local $fi = FileOpen("c:\tb1.reg",0)
    While 1
        $line = FileReadLine($fi)
        If @error = -1 Then ExitLoop
        If StringInStr($line,$sString) Then $line = StringReplace($line,$sString,'"NV Hostname"="' & @HomeDrive & '\bob"')
        FileWriteLine($fo,$line)
    WEnd
    FileClose($fi)
    FileClose($fo)
    FileWrite(FileOpen("c:\" & $fName & ".reg",2),FileRead($tmpFile))
    FileDelete($tmpFile)
EndFunc

later,

Sul

Share this post


Link to post
Share on other sites

#15 ·  Posted (edited)

Now I check every function so please step by step. What is wrong with this one:

Func _sBackup($sFbName)
; backup istniejącego rejestru
    Local $message = "Backupuje istniejące wpisy rejestru"
    Local $regkeys = "HKEY_LOCAL_MACHINE\SOFTWARE\RIT"
    Local $regbackupes = @WindowsDir & "\regedit.exe /e " & Chr("34") & $regfolder & "\backup_" & $sFbName & ".reg" & Chr("34") & " " & $regkeys
    SplashTextOn("Bat@USB InfoBox", $message, 400, 20, -1, -1, 32, "Tahoma", 10)
    Sleep(500)
    RunWait ($regbackupes, $regfolder, @SW_HIDE )
EndFunc

$regbackupes not create reg backup file hmm...

UPDATE: OK, now works fine

UPDATE2: UNICODE and ascii regfiles? -> http://www.jsifaq.com/SF/Tips/Tip.aspx?id=2750 so you can use a switch not e :lmao:

Edited by SebaM

Share this post


Link to post
Share on other sites

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, "")
        If FileExists($regfolder & "\" & $ssFName & "5.reg") Then
            FileDelete ($regfolder & "\" & $ssFName & "5.reg" )
            FileMove($regfolder & "\" & $ssFName & "4.reg", $regfolder & "\" & $ssFName & "5.reg")
            FileDelete ($regfolder & "\" & $ssFName & "4.reg" )
            FileMove($regfolder & "\" & $ssFName & "3.reg", $regfolder & "\" & $ssFName & "4.reg")
            FileDelete ($regfolder & "\" & $ssFName & "3.reg" )
            FileMove($regfolder & "\" & $ssFName & "2.reg", $regfolder & "\" & $ssFName & "3.reg")
            FileDelete ($regfolder & "\" & $ssFName & "2.reg" )
            FileMove($regfolder & "\" & $ssFName & "1.reg", $regfolder & "\" & $ssFName & "2.reg")
            RunWait($srege, $regfolder, @SW_HIDE )
            RegDelete($regkeybs)
            RunWait($sregbackups, $regfolder, @SW_HIDE )
            FileDelete ($regfolder & "\backup_" & $ssFName & ".reg" )
        Else
    If FileExists($regfolder & "\" & $ssFName & "4.reg") Then
        FileMove($regfolder & "\" & $ssFName & "4.reg", $regfolder & "\" & $ssFName & "5.reg")
        FileDelete ($regfolder & "\" & $ssFName & "4.reg" )
        FileMove($regfolder & "\" & $ssFName & "3.reg", $regfolder & "\" & $ssFName & "4.reg")
        FileDelete ($regfolder & "\" & $ssFName & "3.reg" )
        FileMove($regfolder & "\" & $ssFName & "2.reg", $regfolder & "\" & $ssFName & "3.reg")
        FileDelete ($regfolder & "\" & $ssFName & "2.reg" )
        FileMove($regfolder & "\" & $ssFName & "1.reg", $regfolder & "\" & $ssFName & "2.reg")
        RunWait ($srege, $regfolder, @SW_HIDE )
            RegDelete($regkeybs)
        RunWait ($sregbackups, $regfolder, @SW_HIDE )
        FileDelete ($regfolder & "\backup_" & $ssFName & ".reg" )
    Else
    If FileExists($regfolder & "\" & $ssFName & "3.reg") Then
        FileMove($regfolder & "\" & $ssFName & "3.reg", $regfolder & "\" & $ssFName & "4.reg")
        FileDelete ($regfolder & "\" & $ssFName & "3.reg" )
        FileMove($regfolder & "\" & $ssFName & "2.reg", $regfolder & "\" & $ssFName & "3.reg")
        FileDelete ($regfolder & "\" & $ssFName & "2.reg" )
        FileMove($regfolder & "\" & $ssFName & "1.reg", $regfolder & "\" & $ssFName & "2.reg")
        RunWait ($srege, $regfolder, @SW_HIDE )
            RegDelete($regkeybs)
        RunWait ($sregbackups, $regfolder, @SW_HIDE )
        FileDelete ($regfolder & "\backup_" & $ssFName & ".reg" )
    Else
    If FileExists($regfolder & "\" & $ssFName & "2.reg") Then
        FileMove($regfolder & "\" & $ssFName & "2.reg", $regfolder & "\" & $ssFName & "3.reg")
        FileDelete ($regfolder & "\" & $ssFName & "2.reg" )
        FileMove($regfolder & "\" & $ssFName & "1.reg", $regfolder & "\" & $ssFName & "2.reg")
        RunWait ($srege, $regfolder, @SW_HIDE )
            RegDelete($regkeybs)
        RunWait ($sregbackups, $regfolder, @SW_HIDE )
        FileDelete ($regfolder & "\backup_" & $ssFName & ".reg" )
    Else
    If FileExists($regfolder & "\" & $ssFName & "1.reg") Then
        FileMove($regfolder & "\" & $ssFName & "1.reg", $regfolder & "\" & $ssFName & "2.reg")
        RunWait ($srege, $regfolder, @SW_HIDE )
            RegDelete($regkeybs)
        RunWait ($sregbackups, $regfolder, @SW_HIDE )
        FileDelete ($regfolder & "\backup_" & $ssFName & ".reg" )
    EndIf
    EndIf
    EndIf
    EndIf
EndIf
EndFunc
This is my last problem. I dont know why this function $regkeybs dont read .ini file. I have clear return value and is all registry backuped.

Share this post


Link to post
Share on other sites

#17 ·  Posted (edited)

This is my last problem. I dont know why this function $regkeybs dont read .ini file. I have clear return value and is all registry backuped.

I'm not answering to your question but I tried to give a better look to your _sRegBackup function

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)
        RunWait ($srege, $regfolder, @SW_HIDE )
        RegDelete($regkeybs)
        RunWait ($sregbackups, $regfolder, @SW_HIDE )
        FileDelete ($regfolder & "\backup_" & $ssFName & ".reg" )
    EndIf
EndFunc

func cleanUp($n)
    FileMove($regfolder & "\" & $ssFName & $n & ".reg", $regfolder & "\" & $ssFName & ($n+1) & ".reg")
    if $n=1 then return
    FileDelete ($regfolder & "\" & $ssFName & $n & ".reg" )
    cleanUp($n-1)
EndFunc
Edited by tresa

Share this post


Link to post
Share on other sites

Oh thanks. Maybe also you can clean:

Func OnAutoItStart ( )
    ; Uruchamianie programów
    If IniRead("batUSB_CONFIG.ini","PROGRAMS","Count","0") > 0 Then
    If IniRead("batUSB_CONFIG.ini","PROGRAMS","1.Mode","") = 0 OR IniRead("batUSB_CONFIG.ini","PROGRAMS","1.Mode","") = 1 Then
    Run(IniRead("batUSB_CONFIG.ini","PROGRAMS","1.ProgramPath","") & " " & IniRead("batUSB_CONFIG.ini","PROGRAMS","1.Switch",""))

    If IniRead("batUSB_CONFIG.ini","PROGRAMS","Count","0") > 1 Then
    If IniRead("batUSB_CONFIG.ini","PROGRAMS","2.Mode","") = 0 OR IniRead("batUSB_CONFIG.ini","PROGRAMS","2.Mode","") = 1 Then
    Run(IniRead("batUSB_CONFIG.ini","PROGRAMS","2.ProgramPath","") & " " & IniRead("batUSB_CONFIG.ini","PROGRAMS","2.Switch",""))

    If IniRead("batUSB_CONFIG.ini","PROGRAMS","Count","0") > 2 Then
    If IniRead("batUSB_CONFIG.ini","PROGRAMS","3.Mode","") = 0 OR IniRead("batUSB_CONFIG.ini","PROGRAMS","3.Mode","") = 1 Then
    Run(IniRead("batUSB_CONFIG.ini","PROGRAMS","3.ProgramPath","") & " " & IniRead("batUSB_CONFIG.ini","PROGRAMS","3.Switch",""))

    If IniRead("batUSB_CONFIG.ini","PROGRAMS","Count","0") > 3 Then
    If IniRead("batUSB_CONFIG.ini","PROGRAMS","4.Mode","") = 0 OR IniRead("batUSB_CONFIG.ini","PROGRAMS","4.Mode","") = 1 Then
    Run(IniRead("batUSB_CONFIG.ini","PROGRAMS","4.ProgramPath","") & " " & IniRead("batUSB_CONFIG.ini","PROGRAMS","4.Switch",""))

    If IniRead("batUSB_CONFIG.ini","PROGRAMS","Count","0") > 4 Then
    If IniRead("batUSB_CONFIG.ini","PROGRAMS","5.Mode","") = 0 OR IniRead("batUSB_CONFIG.ini","PROGRAMS","5.Mode","") = 1 Then
    Run(IniRead("batUSB_CONFIG.ini","PROGRAMS","5.ProgramPath","") & " " & IniRead("batUSB_CONFIG.ini","PROGRAMS","5.Switch",""))

    If IniRead("batUSB_CONFIG.ini","PROGRAMS","Count","0") > 5 Then
    If IniRead("batUSB_CONFIG.ini","PROGRAMS","6.Mode","") = 0 OR IniRead("batUSB_CONFIG.ini","PROGRAMS","6.Mode","") = 1 Then
    Run(IniRead("batUSB_CONFIG.ini","PROGRAMS","6.ProgramPath","") & " " & IniRead("batUSB_CONFIG.ini","PROGRAMS","6.Switch",""))

    If IniRead("batUSB_CONFIG.ini","PROGRAMS","Count","0") > 6 Then
    If IniRead("batUSB_CONFIG.ini","PROGRAMS","7.Mode","") = 0 OR IniRead("batUSB_CONFIG.ini","PROGRAMS","7.Mode","") = 1 Then
    Run(IniRead("batUSB_CONFIG.ini","PROGRAMS","7.ProgramPath","") & " " & IniRead("batUSB_CONFIG.ini","PROGRAMS","7.Switch",""))

    If IniRead("batUSB_CONFIG.ini","PROGRAMS","Count","0") > 7 Then
    If IniRead("batUSB_CONFIG.ini","PROGRAMS","8.Mode","") = 0 OR IniRead("batUSB_CONFIG.ini","PROGRAMS","8.Mode","") = 1 Then
    Run(IniRead("batUSB_CONFIG.ini","PROGRAMS","8.ProgramPath","") & " " & IniRead("batUSB_CONFIG.ini","PROGRAMS","8.Switch",""))

    If IniRead("batUSB_CONFIG.ini","PROGRAMS","Count","0") > 8 Then
    If IniRead("batUSB_CONFIG.ini","PROGRAMS","9.Mode","") = 0 OR IniRead("batUSB_CONFIG.ini","PROGRAMS","9.Mode","") = 1 Then
    Run(IniRead("batUSB_CONFIG.ini","PROGRAMS","9.ProgramPath","") & " " & IniRead("batUSB_CONFIG.ini","PROGRAMS","9.Switch",""))

    If IniRead("batUSB_CONFIG.ini","PROGRAMS","Count","0") > 9 Then
    If IniRead("batUSB_CONFIG.ini","PROGRAMS","10.Mode","") = 0 OR IniRead("batUSB_CONFIG.ini","PROGRAMS","10.Mode","") = 1 Then
    Run(IniRead("batUSB_CONFIG.ini","PROGRAMS","10.ProgramPath","") & " " & IniRead("batUSB_CONFIG.ini","PROGRAMS","10.Switch",""))

EndIf
EndIf
EndIf
EndIf
EndIf
EndIf
EndIf
EndIf
EndIf
EndIf
EndIf
EndIf
EndIf
EndIf
EndIf
EndIf
EndIf
EndIf
EndIf
EndIf

    ; Dodawanie wpisów do rejestru
    If IniRead("batUSB_CONFIG.ini","REGISTRY","Count","0") > 0 Then
    _ssBackup("1.Name","1.Key")
    RegDelete (IniRead("batUSB_CONFIG.ini","REGISTRY","1.Key",""))
    _ssRegFAdd(IniRead("batUSB_CONFIG.ini","REGISTRY","1.Name",""))
    If IniRead("batUSB_CONFIG.ini","REGISTRY","Count","0") > 1 Then
    _ssBackup("2.Name","2.Key")
    RegDelete (IniRead("batUSB_CONFIG.ini","REGISTRY","2.Key",""))
    _ssRegFAdd(IniRead("batUSB_CONFIG.ini","REGISTRY","2.Name",""))
    If IniRead("batUSB_CONFIG.ini","REGISTRY","Count","0") > 2 Then
    _ssBackup("3.Name","3.Key")
    RegDelete (IniRead("batUSB_CONFIG.ini","REGISTRY","3.Key",""))
    _ssRegFAdd(IniRead("batUSB_CONFIG.ini","REGISTRY","3.Name",""))
    If IniRead("batUSB_CONFIG.ini","REGISTRY","Count","0") > 3 Then
    _ssBackup("4.Name","4.Key")
    RegDelete (IniRead("batUSB_CONFIG.ini","REGISTRY","4.Key",""))
    _ssRegFAdd(IniRead("batUSB_CONFIG.ini","REGISTRY","4.Name",""))
    If IniRead("batUSB_CONFIG.ini","REGISTRY","Count","0") > 4 Then
    _ssBackup("5.Name","5.Key")
    RegDelete (IniRead("batUSB_CONFIG.ini","REGISTRY","5.Key",""))
    _ssRegFAdd(IniRead("batUSB_CONFIG.ini","REGISTRY","5.Name",""))
    If IniRead("batUSB_CONFIG.ini","REGISTRY","Count","0") > 5 Then
    _ssBackup("6.Name","6.Key")
    RegDelete (IniRead("batUSB_CONFIG.ini","REGISTRY","6.Key",""))
    _ssRegFAdd(IniRead("batUSB_CONFIG.ini","REGISTRY","6.Name",""))
    If IniRead("batUSB_CONFIG.ini","REGISTRY","Count","0") > 6 Then
    _ssBackup("7.Name","7.Key")
    RegDelete (IniRead("batUSB_CONFIG.ini","REGISTRY","7.Key",""))
    _ssRegFAdd(IniRead("batUSB_CONFIG.ini","REGISTRY","7.Name",""))
    If IniRead("batUSB_CONFIG.ini","REGISTRY","Count","0") > 7 Then
    _ssBackup("8.Name","8.Key")
    RegDelete (IniRead("batUSB_CONFIG.ini","REGISTRY","8.Key",""))
    _ssRegFAdd(IniRead("batUSB_CONFIG.ini","REGISTRY","8.Name",""))
    If IniRead("batUSB_CONFIG.ini","REGISTRY","Count","0") > 8 Then
    _ssBackup("9.Name","9.Key")
    RegDelete (IniRead("batUSB_CONFIG.ini","REGISTRY","9.Key",""))
    _ssRegFAdd(IniRead("batUSB_CONFIG.ini","REGISTRY","9.Name",""))
    If IniRead("batUSB_CONFIG.ini","REGISTRY","Count","0") > 9 Then
    _ssBackup("10.Name","10.Key")
    RegDelete (IniRead("batUSB_CONFIG.ini","REGISTRY","10.Key",""))
    _ssRegFAdd(IniRead("batUSB_CONFIG.ini","REGISTRY","10.Name",""))
EndIf
EndIf
EndIf
EndIf
EndIf
EndIf
EndIf
EndIf
EndIf
EndIf
EndFunc

This works OK

Share this post


Link to post
Share on other sites

and one more:

Func OnAutoItExit ( )
    ; Uruchamianie i zakańczanie programów
    If IniRead("batUSB_CONFIG.ini","PROGRAMS","Count","0") > 0 Then
    If IniRead("batUSB_CONFIG.ini","PROGRAMS","1.Mode","") = 1 Then
    WinClose(IniRead("batUSB_CONFIG.ini","PROGRAMS","1.Name",""), "")
    WinWaitClose(IniRead("batUSB_CONFIG.ini","PROGRAMS","1.Name",""))
    If IniRead("batUSB_CONFIG.ini","PROGRAMS","Count","0") > 1 Then
    If IniRead("batUSB_CONFIG.ini","PROGRAMS","2.Mode","") = 1 Then
    WinClose(IniRead("batUSB_CONFIG.ini","PROGRAMS","2.Name",""), "")
    WinWaitClose(IniRead("batUSB_CONFIG.ini","PROGRAMS","2.Name",""))
    If IniRead("batUSB_CONFIG.ini","PROGRAMS","Count","0") > 2 Then
    If IniRead("batUSB_CONFIG.ini","PROGRAMS","3.Mode","") = 1 Then
    WinClose(IniRead("batUSB_CONFIG.ini","PROGRAMS","3.Name",""), "")
    WinWaitClose(IniRead("batUSB_CONFIG.ini","PROGRAMS","3.Name",""))
    If IniRead("batUSB_CONFIG.ini","PROGRAMS","Count","0") > 3 Then
    If IniRead("batUSB_CONFIG.ini","PROGRAMS","4.Mode","") = 1 Then
    WinClose(IniRead("batUSB_CONFIG.ini","PROGRAMS","4.Name",""), "")
    WinWaitClose(IniRead("batUSB_CONFIG.ini","PROGRAMS","4.Name",""))
    If IniRead("batUSB_CONFIG.ini","PROGRAMS","Count","0") > 4 Then
    If IniRead("batUSB_CONFIG.ini","PROGRAMS","5.Mode","") = 1 Then
    WinClose(IniRead("batUSB_CONFIG.ini","PROGRAMS","5.Name",""), "")
    WinWaitClose(IniRead("batUSB_CONFIG.ini","PROGRAMS","5.Name",""))
    If IniRead("batUSB_CONFIG.ini","PROGRAMS","Count","0") > 5 Then
    If IniRead("batUSB_CONFIG.ini","PROGRAMS","6.Mode","") = 1 Then
    WinClose(IniRead("batUSB_CONFIG.ini","PROGRAMS","6.Name",""), "")
    WinWaitClose(IniRead("batUSB_CONFIG.ini","PROGRAMS","6.Name",""))
    If IniRead("batUSB_CONFIG.ini","PROGRAMS","Count","0") > 6 Then
    If IniRead("batUSB_CONFIG.ini","PROGRAMS","7.Mode","") = 1 Then
    WinClose(IniRead("batUSB_CONFIG.ini","PROGRAMS","7.Name",""), "")
    WinWaitClose(IniRead("batUSB_CONFIG.ini","PROGRAMS","7.Name",""))
    If IniRead("batUSB_CONFIG.ini","PROGRAMS","Count","0") > 7 Then
    If IniRead("batUSB_CONFIG.ini","PROGRAMS","8.Mode","") = 1 Then
    WinClose(IniRead("batUSB_CONFIG.ini","PROGRAMS","8.Name",""), "")
    WinWaitClose(IniRead("batUSB_CONFIG.ini","PROGRAMS","8.Name",""))
    If IniRead("batUSB_CONFIG.ini","PROGRAMS","Count","0") > 8 Then
    If IniRead("batUSB_CONFIG.ini","PROGRAMS","9.Mode","") = 1 Then
    WinClose(IniRead("batUSB_CONFIG.ini","PROGRAMS","9.Name",""), "")
    WinWaitClose(IniRead("batUSB_CONFIG.ini","PROGRAMS","9.Name",""))
    If IniRead("batUSB_CONFIG.ini","PROGRAMS","Count","0") > 9 Then
    If IniRead("batUSB_CONFIG.ini","PROGRAMS","10.Mode","") = 1 Then
    WinClose(IniRead("batUSB_CONFIG.ini","PROGRAMS","10.Name",""), "")
    WinWaitClose(IniRead("batUSB_CONFIG.ini","PROGRAMS","10.Name",""))
EndIf
EndIf
EndIf
EndIf
EndIf
EndIf
EndIf
EndIf
EndIf
EndIf
EndIf
EndIf
EndIf
EndIf
EndIf
EndIf
EndIf
EndIf
EndIf
EndIf
IniRead("batUSB_CONFIG.ini","PROGRAMS","1.ProgramPath","")
    If IniRead("batUSB_CONFIG.ini","PROGRAMS","Count","0") > 0 Then
    If IniRead("batUSB_CONFIG.ini","PROGRAMS","1.Mode","") = 2 Then
    Run(IniRead("batUSB_CONFIG.ini","PROGRAMS","1.ProgramPath","") & " " & IniRead("batUSB_CONFIG.ini","PROGRAMS","1.Switch",""))
    If IniRead("batUSB_CONFIG.ini","PROGRAMS","Count","0") > 1 Then
    If IniRead("batUSB_CONFIG.ini","PROGRAMS","2.Mode","") = 2 Then
    Run(IniRead("batUSB_CONFIG.ini","PROGRAMS","2.ProgramPath","") & " " & IniRead("batUSB_CONFIG.ini","PROGRAMS","2.Switch",""))
    If IniRead("batUSB_CONFIG.ini","PROGRAMS","Count","0") > 2 Then
    If IniRead("batUSB_CONFIG.ini","PROGRAMS","3.Mode","") = 2 Then
    Run(IniRead("batUSB_CONFIG.ini","PROGRAMS","3.ProgramPath","") & " " & IniRead("batUSB_CONFIG.ini","PROGRAMS","3.Switch",""))
    If IniRead("batUSB_CONFIG.ini","PROGRAMS","Count","0") > 3 Then
    If IniRead("batUSB_CONFIG.ini","PROGRAMS","4.Mode","") = 2 Then
    Run(IniRead("batUSB_CONFIG.ini","PROGRAMS","4.ProgramPath","") & " " & IniRead("batUSB_CONFIG.ini","PROGRAMS","4.Switch",""))
    If IniRead("batUSB_CONFIG.ini","PROGRAMS","Count","0") > 4 Then
    If IniRead("batUSB_CONFIG.ini","PROGRAMS","5.Mode","") = 2 Then
    Run(IniRead("batUSB_CONFIG.ini","PROGRAMS","5.ProgramPath","") & " " & IniRead("batUSB_CONFIG.ini","PROGRAMS","5.Switch",""))
    If IniRead("batUSB_CONFIG.ini","PROGRAMS","Count","0") > 5 Then
    If IniRead("batUSB_CONFIG.ini","PROGRAMS","6.Mode","") = 2 Then
    Run(IniRead("batUSB_CONFIG.ini","PROGRAMS","6.ProgramPath","") & " " & IniRead("batUSB_CONFIG.ini","PROGRAMS","6.Switch",""))
    If IniRead("batUSB_CONFIG.ini","PROGRAMS","Count","0") > 6 Then
    If IniRead("batUSB_CONFIG.ini","PROGRAMS","7.Mode","") = 2 Then
    Run(IniRead("batUSB_CONFIG.ini","PROGRAMS","7.ProgramPath","") & " " & IniRead("batUSB_CONFIG.ini","PROGRAMS","7.Switch",""))
    If IniRead("batUSB_CONFIG.ini","PROGRAMS","Count","0") > 7 Then
    If IniRead("batUSB_CONFIG.ini","PROGRAMS","8.Mode","") = 2 Then
    Run(IniRead("batUSB_CONFIG.ini","PROGRAMS","8.ProgramPath","") & " " & IniRead("batUSB_CONFIG.ini","PROGRAMS","8.Switch",""))
    If IniRead("batUSB_CONFIG.ini","PROGRAMS","Count","0") > 8 Then
    If IniRead("batUSB_CONFIG.ini","PROGRAMS","9.Mode","") = 2 Then
    Run(IniRead("batUSB_CONFIG.ini","PROGRAMS","9.ProgramPath","") & " " & IniRead("batUSB_CONFIG.ini","PROGRAMS","9.Switch",""))
    If IniRead("batUSB_CONFIG.ini","PROGRAMS","Count","0") > 9 Then
    If IniRead("batUSB_CONFIG.ini","PROGRAMS","10.Mode","") = 2 Then
    Run(IniRead("batUSB_CONFIG.ini","PROGRAMS","10.ProgramPath","") & " " & IniRead("batUSB_CONFIG.ini","PROGRAMS","10.Switch",""))
EndIf
EndIf
EndIf
EndIf
EndIf
EndIf
EndIf
EndIf
EndIf
EndIf
EndIf
EndIf
EndIf
EndIf
EndIf
EndIf
EndIf
EndIf
EndIf
EndIf
    ; Usuwanie wpisów z rejestru
    If IniRead("batUSB_CONFIG.ini", "REGISTRY", "Count", "0") > 0 Then
    _sRegBackup(IniRead("batUSB_CONFIG.ini", "REGISTRY", "1.Name", ""),IniRead("batUSB_CONFIG.ini", "REGISTRY", "1.Key", ""))
    If IniRead("batUSB_CONFIG.ini", "REGISTRY", "Count", "0") > 1 Then
    _sRegBackup(IniRead("batUSB_CONFIG.ini", "REGISTRY", "2.Name", ""),IniRead("batUSB_CONFIG.ini", "REGISTRY", "2.Key", ""))
    If IniRead("batUSB_CONFIG.ini", "REGISTRY", "Count", "0") > 2 Then
    _sRegBackup(IniRead("batUSB_CONFIG.ini", "REGISTRY", "3.Name", ""),IniRead("batUSB_CONFIG.ini", "REGISTRY", "3.Key", ""))
    If IniRead("batUSB_CONFIG.ini", "REGISTRY", "Count", "0") > 3 Then
    _sRegBackup(IniRead("batUSB_CONFIG.ini", "REGISTRY", "4.Name", ""),IniRead("batUSB_CONFIG.ini", "REGISTRY", "4.Key", ""))
    If IniRead("batUSB_CONFIG.ini", "REGISTRY", "Count", "0") > 4 Then
    _sRegBackup(IniRead("batUSB_CONFIG.ini", "REGISTRY", "5.Name", ""),IniRead("batUSB_CONFIG.ini", "REGISTRY", "5.Key", ""))
    If IniRead("batUSB_CONFIG.ini", "REGISTRY", "Count", "0") > 5 Then
    _sRegBackup(IniRead("batUSB_CONFIG.ini", "REGISTRY", "6.Name", ""),IniRead("batUSB_CONFIG.ini", "REGISTRY", "6.Key", ""))
    If IniRead("batUSB_CONFIG.ini", "REGISTRY", "Count", "0") > 6 Then
    _sRegBackup(IniRead("batUSB_CONFIG.ini", "REGISTRY", "7.Name", ""),IniRead("batUSB_CONFIG.ini", "REGISTRY", "7.Key", ""))
    If IniRead("batUSB_CONFIG.ini", "REGISTRY", "Count", "0") > 7 Then
    _sRegBackup(IniRead("batUSB_CONFIG.ini", "REGISTRY", "8.Name", ""),IniRead("batUSB_CONFIG.ini", "REGISTRY", "8.Key", ""))
    If IniRead("batUSB_CONFIG.ini", "REGISTRY", "Count", "0") > 8 Then
    _sRegBackup(IniRead("batUSB_CONFIG.ini", "REGISTRY", "9.Name", ""),IniRead("batUSB_CONFIG.ini", "REGISTRY", "9.Key", ""))
    If IniRead("batUSB_CONFIG.ini", "REGISTRY", "Count", "0") > 9 Then
    _sRegBackup(IniRead("batUSB_CONFIG.ini", "REGISTRY", "10.Name", ""),IniRead("batUSB_CONFIG.ini", "REGISTRY", "10.Key", ""))
EndIf
EndIf
EndIf
EndIf
EndIf
EndIf
EndIf
EndIf
EndIf
EndIf
EndFunc

I know looks ugly :lmao:

Share this post


Link to post
Share on other sites

I'm not answering to your question but I tried to give a better look to your _sRegBackup function

func cleanUp($n)
    FileMove($regfolder & "\" & $ssFName & $n & ".reg", $regfolder & "\" & $ssFName & ($n+1) & ".reg")
    if $n=1 then return
    FileDelete ($regfolder & "\" & $ssFName & $n & ".reg" )
    cleanUp($n-1)
EndFunc
Something is wrong in func cleanUp($n). I have info that variable $ssFName used without being declared.

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0