![]() |
#1 |
Junior Member
Join Date: Dec 2009
Posts: 12
|
ReadRegStr syntax?
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 |
![]() |
![]() |
![]() |
#2 |
Moderator
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,333
|
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! IntOp $PostCount $PostCount + 1 |
![]() |
![]() |
![]() |
#3 |
Junior Member
Join Date: Dec 2009
Posts: 12
|
Thank you for the reply. Compiler output is:
Invalid Command: ReadRegStr ${VISTA_HOST} is devined as var VISTA_HOST? What am I missing here? |
![]() |
![]() |
![]() |
#4 | |
Moderator
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,333
|
Defining a variable like that is usually pointless.
Just do Quote:
IntOp $PostCount $PostCount + 1 |
|
![]() |
![]() |
![]() |
#5 |
Junior Member
Join Date: Dec 2009
Posts: 12
|
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} |
![]() |
![]() |
![]() |
#6 |
Moderator
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,333
|
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.
IntOp $PostCount $PostCount + 1 |
![]() |
![]() |
![]() |
|
Thread Tools | Search this Thread |
Display Modes | |
|
|