Archive: Registry and WordFunc help?


Registry and WordFunc help?
hi i have a problem with changing the registry value if the exe file moved or changed name
I want to find all and change the registry value,write founded in reg file or change with Write value.....?
This my script:

GetTempFileName $R0
FileOpen $R1 $R0 w
FileWrite $R1 'Windows Registry Editor Version 5.00$\r$\n$\r$\n'
FileWrite $R1 '[HKEY_CURRENT_USER\Software\my software]$\r$\n$\r$\n'

${registry::Open} "HKEY_CURRENT_USER\Software\my software" "/K=0 /V=1 /S=0 /B=1 /N='LocalFileName'" $0
StrCmp $0 0 0 loop
MessageBox MB_OK "Error" IDOK close

loop:
${registry::Find} "$0" $1 $2 $3 $4
StrCmp $4 '' close
StrCmp $4 'REG_KEY' 0 +3
;FileWrite $R1 '[$1]$\r$\n'
FileWrite $R1 '"$1"=$\r$\n'
goto +4
${WordFind} "$3" "settings" "E+2*}" $6
;${registry::Write} "$1" "$2" "$EXEDIR$6" "REG_SZ" $R0
FileWrite $R1 '[HKEY_CURRENT_USER\$1]$\r$\n'
FileWrite $R1 '"$2"="$EXEDIR\$6"$\r$\n$\r$\n'
goto loop

close:
${registry::Close} "$0"
${registry::Unload}
FileClose $R1


and this the result:
Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\my software]

[HKEY_CURRENT_USER\Software\my software\11]
"LocalFileName"="C:\PortableApps\NSISPortable\App\NSIS\Examples\Registry\\my software\Administrator\sc_installer_11\sc_installer.zip"

[HKEY_CURRENT_USER\Software\my software\12]
"LocalFileName"="C:\PortableApps\NSISPortable\App\NSIS\Examples\Registry\\my software\Administrator\ScrollLicense_12\ScrollLicense.zip"

you see the value backsplash \ only one

it has to be
[HKEY_CURRENT_USER\Software\my software\11]
"LocalFileName"="C:\\PortableApps\\NSISPortable\\App\\NSIS\\Examples\\Registry\\my software\\Administrator\\sc_installer_11\\sc_installer.zip"


sorry my english is very bad
thanks a lot ......

Does the registry plug-in not export reg files?

Edit: Yes it does.

Stu


FileOpen $R1 $R0 w

FileWrite $R1 'Windows Registry Editor Version 5.00$\r$\n$\r$\n'
you create an ANSI file like this, then use "REGEDIT4" instead, your's is UTF-8 header

and do a StrRep on \ to get \\

yes Afrow it does, but i think he wants only a specifi entry

sorry i have found this solution
This script looking for value and replace it
and this works fine

${registry::Open} "HKEY_CURRENT_USER\Software\my software" "/K=0 /V=1 /S=0 /B=1 /N='LocalFileName'" $0
StrCmp $0 0 0 loop
MessageBox MB_OK "Error" IDOK close

loop:
${registry::Find} "$0" $1 $2 $3 $4

StrCmp $4 '' close
${WordFind} "$3" "settings" "E+2*}" $6
${registry::Write} "HKEY_CURRENT_USER\$1" "$2" "$EXEDIR$6" "$4" $9

goto loop

close:
${registry::Close} "$0"
${registry::Unload}

thanks a lot


idd, my bad, thats possible too with the registry function