Losing variable

Got a problem you cannot solve? Try here.
Dan Fisher
Posts: 15
Joined: Tue Sep 05, 2006 6:40 am
Location: UK

Losing variable

Postby Dan Fisher » Tue Sep 12, 2006 5:29 am

Hi, I have a variable problem in IA6: A variable is declared and assigned a value in an included script, and then used in another included script later on. This works fine, and the variable's contents can be seen in the watch window until the MS SQL Instances plugin is invoked in the second included script, after which the watch window reports the variable as not defined (as if it's gone out of scope). Popping up the variable's contents in a message box confirms that it has 'disappeared', and the literal '$MYVARIABLE$' is displayed.

I've tried restarting IA, and rebooting (since it seems like a weird memory problem), to no avail. Has anyone else come across this?

Cheers
Dan

MichaelNesmith
Posts: 3452
Joined: Thu Dec 22, 2005 7:17 pm
Contact:

Postby MichaelNesmith » Tue Sep 12, 2006 7:06 am

Variables won't go out of scope, as there is no local scope in MSIcode - all your Include Script commands directly include their relevant scripts. I think what might be going on is that you have some sort of issue with a plug-in and/or undefined variables which is causing this problem further down the road.
Michael Nesmith
InstallAware
Home of The Next Generation MSI Installer
Get your free copy today - http://www.installaware.com/

Dan Fisher
Posts: 15
Joined: Tue Sep 05, 2006 6:40 am
Location: UK

Postby Dan Fisher » Tue Sep 12, 2006 7:44 am

That's what I thought about scope in IA, which is what's so baffling. Anyway, it now seems that there are a whole bunch of variables that 'disappear' after the call to the MS SQL Instances plugin, some of which are declared only a few lines beforehand.

I don't know if it has any bearing on the issue, but in the debugger every line seems to be executed a line late. e.g. a variable is declared, but it remains undefined until the next line has been executed. This is bringing back terrible memories of Dev Studio! Think I might try this on a clean machine...
Dan

Dan Fisher
Posts: 15
Joined: Tue Sep 05, 2006 6:40 am
Location: UK

Postby Dan Fisher » Tue Sep 12, 2006 9:54 am

OK I seem to tracked this one down - I had the line 'Get System Setting Logged on Computer Name into MACHINENAME' in my first included script. Moving this out into the main script seems to have made everything work again.

Is this a bug, or is there a limitation in calling script commands within included scripts?
Dan

MichaelNesmith
Posts: 3452
Joined: Thu Dec 22, 2005 7:17 pm
Contact:

Postby MichaelNesmith » Tue Sep 12, 2006 9:25 pm

Neither a bug, nor a limitation - unless its something we don't know of yet! If you conditionally included the first script sometimes and not at other times, this might explain the problem.
Michael Nesmith

InstallAware

Home of The Next Generation MSI Installer

Get your free copy today - http://www.installaware.com/

Dan Fisher
Posts: 15
Joined: Tue Sep 05, 2006 6:40 am
Location: UK

Postby Dan Fisher » Wed Sep 13, 2006 5:44 am

Sorry that was something of a red herring. The real culprit was that the first included script read from a udl file (using Read from Text File, ensuring the end was reached to close the file). It seems that this results in some problem inside the MS SQL Instances plugin, which manifests itself in bizarre ways in my scripts.

So, not a bug in using commands in included scripts, and probably not really a bug in the plugin, but some odd behaviour by MS SQL. Nothing new there then!

Thanks for your help, Michael
Dan


Return to “Technical Support”

Who is online

Users browsing this forum: No registered users and 52 guests