Joel
7th June 2003 22:07 UTC
$var and !define, help
I have this:
!define 0 "bla0"
!define 1 "bla1"
... until 9
after math operations, the awnser is save
in the "$R0" variable...
I wanna display a messagebox with the awnser the
text predefined above..
if the awnser is "0" displays "bla", like this:
MessageBox MB_OK "${$R0}"
;where $R0 is the awnser but I'll display the text predefined
But it doesn't work... any ideas? :winamp: :)
deguix
7th June 2003 22:41 UTC
I beleave, that is because that the ${} don't support variables on it, like you !define ABOUT$R0, will show that you defined ABOUT$R0.
kichik
8th June 2003 14:23 UTC
Defines are compile time and variables are runtime. NSIS can't possibly guess what $R0 will hold when running the code.
You'll have to either use a lot of StrCmps, or if you want to make a shortcut, create an array using System.dll, set the right values in every cell and get the requested value by the offset (0, 1, ...).
Joel
8th June 2003 16:48 UTC
In my case how can I make that array....
I know what array is :), but can I implement with the system.dll
kichik
8th June 2003 16:56 UTC
On second thought, using lots of StrCmp will be a lot easier. Making a little macro for it will help shorten it up.
Joel
8th June 2003 18:42 UTC
Ok thanks...I'll work with the StrCmp in Macros
:)
Joel
9th June 2003 06:42 UTC
OK...in this thread was about
!define --> $var ... ok...
can be $var --> !define (without be declare)?
kichik
9th June 2003 11:56 UTC
When you define A as B the compiler will just replace textually, on compile time, every occurrence of ${A} with B. Therefor bl${A} will become blB, ${A}ringToFront will become, and treated as BringToFront, etc. The value of the definition does not change on runtime. The installer doesn't even know there was a definition there.