View Single Post
Old 31st January 2012, 18:58   #1
ferdhy_raja
Junior Member
 
Join Date: Jan 2012
Posts: 2
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:
code:
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:
code:
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
code:
[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 ......
ferdhy_raja is offline   Reply With Quote