I have the following code that works that queries the user for an IP then stores the IP as a session variable:
WriteRegExpandStr ${env_hklm} ASTRO_SSH_HOST "$VISTA_HOST"
I want to detect the presence of a pre-existing entry so that it will fill in the default IP on re-install so the user does not have to re-enter it. This gives a compiler error:
ReadRegSt ${VISTA_HOST} ${env_hklm} "" "ASTRO_SSH_HOST"
What might the proper syntax be for this?
Thanks!
-- IV
ReadRegStr syntax?
6 posts
You are trying to store something in a define. Defines are replaced by its text content at compile-time, you need to use a variable to store things at run-time...
When asking questions, always include the compiler error message!
When asking questions, always include the compiler error message!
Thank you for the reply. Compiler output is:
Invalid Command: ReadRegStr
${VISTA_HOST} is devined as var VISTA_HOST? What am I missing here?
Invalid Command: ReadRegStr
${VISTA_HOST} is devined as var VISTA_HOST? What am I missing here?
Defining a variable like that is usually pointless.
Just do
Just do
Var VISTA_HOST
Section
!define env_hklm HKLM ;?
ReadRegSt $VISTA_HOST ${env_hklm} "" "ASTRO_SSH_HOST" ; Pretty sure you don't want "" as the path, you probably want "Software\Something"
SectionEnd
So I want to set $VISTA_HOST to 'Enter IP here.' on first time install then upgrades will pre-fill the IP address. How is null string comparison done in NSIS? The below does not seem to work:
ReadRegStr $VISTA_HOST ${env_hklm} "ASTRO_SSH_HOST"
${If} $VISTA_HOST == ""
StrCpy $VISTA_HOST "$HOST"
${EndIf}
ReadRegStr $VISTA_HOST ${env_hklm} "ASTRO_SSH_HOST"
${If} $VISTA_HOST == ""
StrCpy $VISTA_HOST "$HOST"
${EndIf}
Since you don't show us what ${env_hklm} is we cannot exactly test but yes, checking for a empty string can be done with == "". Maybe you should just try MessageBox mb_ok "|$VISTA_HOST|" so you can see what you read.