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
Old 2nd February 2012, 15:15   #2
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
Does the registry plug-in not export reg files?

Edit: Yes it does.

Stu
Afrow UK is offline   Reply With Quote
Old 2nd February 2012, 16:36   #3
Brummelchen
Major Dude
 
Join Date: May 2003
Posts: 681
Quote:
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
Brummelchen is offline   Reply With Quote
Old 2nd February 2012, 17:00   #4
ferdhy_raja
Junior Member
 
Join Date: Jan 2012
Posts: 2
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
ferdhy_raja is offline   Reply With Quote
Old 2nd February 2012, 17:06   #5
Brummelchen
Major Dude
 
Join Date: May 2003
Posts: 681
idd, my bad, thats possible too with the registry function
Brummelchen is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump