Page 1 of 1

How to determine if variable has been defined or not?

Posted: Wed Feb 29, 2012 4:35 pm
by 5aclockshadow
How to determine if variable has been defined or not?

I've recently added a new variable (SYSTEMTYPE) to my setup and set it persistent (to remember when restarting). Everyting works great if installing on a new system or if installing on a system that had a newer installer (that had the new SYSTEMTYPE variable) previously ran on it.

The problem I'm seeing is when running the newer setups on a system that had a slightly older setup (any setup prior to adding new SYSTEMTYPE variable) previously ran on it.

I receive:
"Runtime error in setup script:

Line 13: Attempting to get value of undefined variable
SYSTEMTYPE"

And the setup fails.

I do want to find and use SYSTEMTYPE's value on newer systems but on older systems I just want to assign it a default value.

How can I do this? I've searched for "How can I check for a variable not defined ?" and found this post:
http://www.installaware.com/forum/viewt ... f=2&t=2329

But this didn't seem to work for me.

Is there an easy way to check if SYSTEMTYPE has been defined? If so, I'll use that value. If not, I'll assign some value.

Seems simple so I think I may be missing something...

Thanks in advance for any help!

Re: How to determine if variable has been defined or not?

Posted: Thu Mar 01, 2012 9:14 am
by FrancescoT
Dear User,

Have you seen this post: http://www.installaware.com/forum/viewt ... f=2&t=6100

Just summarizing have you tryed this?

if Variable test not is Defined
MessageBox: is Defined?, test is not defined!
Set Variable test to
end
if Variable test is Defined
MessageBox: test is defined, test is defined!$NEWLINE$Test = "$test$"
end

Hope this helps you.

Regards

Re: How to determine if variable has been defined or not?

Posted: Fri Mar 02, 2012 9:25 pm
by 5aclockshadow
Yes, that worked ... I knew it had to be something simple that I was missing.

Thanks!

Re: How to determine if variable has been defined or not?

Posted: Mon Mar 05, 2012 3:25 am
by FrancescoT
:)