How to determine if variable has been defined or not?

Got a problem you cannot solve? Try here.
Post Reply
5aclockshadow
Posts: 63
Joined: Thu Feb 05, 2009 9:27 am
Location: NJ, USA

How to determine if variable has been defined or not?

Post 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!
FrancescoT
Site Admin
Posts: 5361
Joined: Sun Aug 22, 2010 4:28 am

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

Post 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
Francesco Toscano
InstallAware Software

White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Publications - http://www.installaware.com/publications-review.htm
InstallAware Help -F1 anywhere in the InstallAware IDE
5aclockshadow
Posts: 63
Joined: Thu Feb 05, 2009 9:27 am
Location: NJ, USA

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

Post by 5aclockshadow »

Yes, that worked ... I knew it had to be something simple that I was missing.

Thanks!
FrancescoT
Site Admin
Posts: 5361
Joined: Sun Aug 22, 2010 4:28 am

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

Post by FrancescoT »

:)
Francesco Toscano
InstallAware Software

White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Publications - http://www.installaware.com/publications-review.htm
InstallAware Help -F1 anywhere in the InstallAware IDE
Post Reply