Winamp & Shoutcast Forums

Winamp & Shoutcast Forums (http://forums.winamp.com/index.php)
-   NSIS Discussion (http://forums.winamp.com/forumdisplay.php?f=65)
-   -   Read a reg key --- write a reg key (http://forums.winamp.com/showthread.php?t=210362)

sLeX 14th March 2005 08:34

Read a reg key --- write a reg key
 
Hi there,

this was maybe asked before, but if so, I didn´t find it !

I want to read out a registry key. If it exists I want the installer to do nothing.
If it doesn´t exist I want the program to write 3 new keys.

I found all the commands in the readme, but don´t know how to put them in a right order. so please help me with that and post a complete sequence, cause I´m a totally newb in coding !

Davion 14th March 2005 08:51

code:

ReadRegStr $R0 HKLM "Software\myApp" shit ;Reads the Value of Shit into the Var $R0

StrCmp $R0 "VALUE" done write ;If $R0 is like "VALUE" it goes to done, if it has another value or isn't there it goes to write

write:
WriteRegStr HKLM "Software\myApp" "shit" "VALUE"
WriteRegStr HKLM "Software\myApp" "shit" "VALUE1"
WriteRegStr HKLM "Software\myApp" "shit" "VALUE2"
done:




this code was written Online, but it should work
greetz Dave

sLeX 14th March 2005 09:12

direkt mal testen ...

thanks ;)


edit:


Quote:

function "key"
ReadRegStr $R0 HKLM "Software\HKS Informatik GmbH\Kosy-KK" InstallVersion
StrCmp $R0 "4.0.1.6" done write
write:
WriteRegStr HKLM "Software\HKS Informatik GmbH\bla" "key1" "10"
WriteRegStr HKLM "Software\HKS Informatik GmbH\bla" "key2" "11"
WriteRegStr HKLM "Software\HKS Informatik GmbH\bla" "key3" "12"
done:
functionend

my function now looks like this, just for testing!
But when i´ve compiled the program it shows an error:

1 warning:
install function "key" not referenced - zeroing code (211-217) out

Davion 14th March 2005 10:04

You have to call your function key in another function or section, else it isn't referenced and so the Compiler will leave it out

If you have a main section which is installed anyway, put there the Line "call key"

the other option is to don't put the code in a Function but in the Section where you need it.

If you write a function you ever have to call it

Hope this helps to understand

greetz Dave

sLeX 14th March 2005 11:37

wohoo ... now it´s doing fine and works like it´s meant to be ! thanks a lot

p.s
danke


All times are GMT. The time now is 05:06.

Copyright © 1999 - 2010 Nullsoft. All Rights Reserved.