PDA

View Full Version : Problem with global variables



kaneda
06-07-2006, 05:29 AM
Well,it's the simplest thing on earth,but i 'm having trouble with it :o

I simply have a global variable, declared in the top of the script. i Have 3 functions, all of them are similar,all they do is set a value for the global variable (which will depend on the former value). But it's not working. I've noticed,using messageboxes to display the variable value in each function before changing it,that once i get into a function,there's no value in the variable, it's empty, eventhough i just went through a function that setted a value to it. why the hell is this happening,if the variable is supposed to be global?

ISIZBEN
06-07-2006, 07:51 AM
In the property manager i set the value of some property "MSSQL" and during installation proces i get an empty and sometimes half of the actual string back when try to retrieve the value using MsiGetProperty.


Ben

Christopher Painter
06-07-2006, 08:52 AM
During the Beta there was a long discussion on this. Basically due to the refactoring of the ISScript global variables are no longer supported. Also since InstallScript CA's now compile into Type 1 Custom Actions you are limited in the MSI API's and properties that you can access while in a deferred execution context. This is the `correct` MSI way of doing things and a really good thing to have happen ( although it may be painful at first. )

I believe that this issue is going to come up alot and someone ( Robert? ) should write a detailed article on the subject and make it a sticky in this forum.

RobertDickau
06-07-2006, 09:05 AM
It's not a technical discussion, but the point is mentioned in the "Discussion on Basic MSI Projects with InstallScript Custom Actions" section of KB (http://support.installshield.com) article Q112115, "HOWTO: Upgrading Projects to InstallShield 12".

kaneda
06-07-2006, 09:33 AM
ok,thanks you all for the help :)

Christopher Painter
06-07-2006, 09:44 AM
It's not a technical discussion, but the point is mentioned in the "Discussion on Basic MSI Projects with InstallScript Custom Actions" section of KB (http://support.installshield.com) article Q112115, "HOWTO: Upgrading Projects to InstallShield 12".

Very Nice! Sticky Stick Sticky! :)

ISIZBEN
06-07-2006, 09:47 AM
Hey guy's,

could plz give me a hand on this. U can find my thread here (http://community.macrovision.com/showthread.php?t=159780)

tnx,
Ben

RobertDickau
06-07-2006, 09:59 AM
Very Nice! Sticky Stick Sticky! :)
Sticking, sticking, stuck.

DebbieL
06-07-2006, 10:02 AM
Please note that global variables do work in some scenarios. For example, they do work in the following cases:

InstallScript projects
Event-driven InstallScript code in InstallScript MSI projects

However, global variables are no longer maintained between individual InstallScript custom action calls in InstallScript MSI projects or in Basic MSI projects. KB article Q112115 covers these cases.

Debbie Landers
Macrovision Corporation