Go Back   Winamp Forums > Developer Center > NSIS Discussion

Reply
Thread Tools Search this Thread Display Modes
Old 18th September 2007, 10:59   #1
aemik
Member
 
Join Date: Jun 2007
Location: Böblingen
Posts: 94
overwrite regkeys

hello,

i use "overwrite off" for my "file" commands.
can i also use it "writeregstr ..." ?
i dont want to overwrite regkeys. is it possible?
aemik is offline   Reply With Quote
Old 18th September 2007, 14:11   #2
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 2,777
no, but you can try to read it first, and only write if it sets the error flag (or returns empty string)

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 18th September 2007, 16:57   #3
pospec
Senior Member
 
pospec's Avatar
 
Join Date: Jun 2007
Location: Otrokovice, Czech Republic
Posts: 308
Yes, that's right. The best way is write your own macro ;-)
pospec is offline   Reply With Quote
Old 11th January 2008, 13:17   #4
aemik
Member
 
Join Date: Jun 2007
Location: Böblingen
Posts: 94
I have a long list (50) of RegKeys like this:

WriteRegStr HKLM "Software\x\x" "abc" "def"
...
WriteRegStr HKLM "Software\x\x" "asd" "gfd"


I only want to write them if they not exist. Can you please give me the code for this problem??

Thnaks for your help
aemik
aemik is offline   Reply With Quote
Old 11th January 2008, 13:19   #5
pospec
Senior Member
 
pospec's Avatar
 
Join Date: Jun 2007
Location: Otrokovice, Czech Republic
Posts: 308
Yes, I can. Sorry for that Czech names

I can also provide script which converts .reg file into NSIS commands like ${registry::________} ... ... ... ...
pospec is offline   Reply With Quote
Old 11th January 2008, 13:31   #6
pospec
Senior Member
 
pospec's Avatar
 
Join Date: Jun 2007
Location: Otrokovice, Czech Republic
Posts: 308
The script was too big.
Attached Files
File Type: nsi zapisreg_neprepis.nsi (1.6 KB, 162 views)
pospec is offline   Reply With Quote
Old 11th January 2008, 13:46   #7
aemik
Member
 
Join Date: Jun 2007
Location: Böblingen
Posts: 94
thank you for help.

How can i include this script and how can i use it for my registry keys?
aemik is offline   Reply With Quote
Old 11th January 2008, 14:07   #8
pospec
Senior Member
 
pospec's Avatar
 
Join Date: Jun 2007
Location: Otrokovice, Czech Republic
Posts: 308
Copy / paste?

Try something like ${ZapisReg} "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion" "ProductId" "this is really CRAP!" "REG_SZ"
pospec is offline   Reply With Quote
Old 11th January 2008, 14:14   #9
aemik
Member
 
Join Date: Jun 2007
Location: Böblingen
Posts: 94
where is registry.nsh?
aemik is offline   Reply With Quote
Old 11th January 2008, 14:48   #10
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Birmingham, England
Posts: 8,202
Just use a macro:
code:
!macro _WriteReg Type Root Key Name Value
Push $R0
ClearErrors
ReadReg${Type} $R0 `${Root}` `${Key}` `${Name}`
Pop $R0
IfErrors 0 +2
WriteReg${Type} `${Root}` `${Key}` `${Name}` `${Value}`
!macroend

!define WriteRegDWORD `!insertmacro _WriteReg DWORD`
!define WriteRegBin `!insertmacro _WriteReg Bin`
!define WriteRegStr `!insertmacro _WriteReg Str`



${WriteRegDWORD} HKLM `Software\MyApp` `Blah1` 1
${WriteRegBin} HKLM `Software\MyApp` `Blah2` ABCD
${WriteRegStr} HKLM `Software\MyApp` `Blah3` Hello

Edit: shortened.

Stu

Need an installer? http://www.afrowsoft.co.uk
Afrow UK is offline   Reply With Quote
Old 11th January 2008, 15:43   #11
pospec
Senior Member
 
pospec's Avatar
 
Join Date: Jun 2007
Location: Otrokovice, Czech Republic
Posts: 308
Nice. Why should I do it simply if I can do it intricately?
pospec is offline   Reply With Quote
Reply
Go Back   Winamp 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