![]() |
Is Variable Declared?
Is there any way to determine in a script if a variable has been declared or not? I want to be able to declare a variable using a macro, but only if it hasn't already been declared.
|
Variables aren't so much declared as that they either contain data, or they don't. So you could just use :
StrCmp $Var "" +2 0 MessageBox MB_OK "Var is 'declared'" |
Yes but if a variable hasn't been declared from within a macro, then that will throw a compiler warning.
You should define a constant of the same name of that variable and check if that constant exists with !ifdef. E.g. code: -Stu |
ah, good point!
|
code: -dandaman32 |
Thanks for the suggestions. That's certainly a clever and viable workaround!
But not exactly what I was looking for as it pollutes the macro namespace and is more apt to cause collisions when using headers from multiple sources. :( OTOH, I rearchitected what I was doing so I didn't end up needing it anyway. At least not this time. :) |
| All times are GMT. The time now is 04:56. |
Copyright © 1999 - 2010 Nullsoft. All Rights Reserved.