Jump to content


This is a ready-only archive of the InstallSite Forum. You cannot post any new content here. / Dies ist ein Archiv des InstallSite Forums. Hier können keine neuen Beiträge veröffentlicht werden.
Photo

global variable issue


2 replies to this topic

haroldxious

haroldxious
  • Full Members
  • 70 posts

Posted 02 February 2007 - 06:50

i know that in installshield 12 basic msi global variables do not share state between custom action invocations.

i need a suuggestion on how will i execute this code.

//Sample code only

function One() //this function must NOT be set to defered exec w/ systemcontext.
begin
nResult = GetValue();
end;

function Two() //this function must be set to defered exec with system context
begin
SetValue(nResult);
end;

*it is easy if global variable is still valid, ill just set nReturn as global, but the problem is i cant merge the GetValue and SetValue in one custom action because they have different In-Script executions. i need them to have different in-script execution.

any suggestions on how to solve this one?

thank you very much

Edited by haroldxious, 02 February 2007 - 06:51.


kgiloo

kgiloo
  • Full Members
  • 60 posts

Posted 02 February 2007 - 07:29

why not use the registry to get/set your values?

Stefan Krueger

Stefan Krueger

    InstallSite.org

  • Administrators
  • 13,269 posts

Posted 02 February 2007 - 09:58

Ususally you don't need a custom action to read environment variables. Replace One with a custom action like this:

Type: Set Property
Property Name: Two (the name of your deferred custom action)
Value: [%ENV_VAR] (where ENV_VAR is the name of the environment variable you want to get)

In Two use:
function Two() //this function must be set to defered exec with system context
begin
MsiGetProperty(..., "CustomActionData", ...); // CustomActionData is a predefined name which deferred actions can use to read a property that matches the name of the action
SetValue(nResult);
end;