cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
lmoulder
Level 3

Working with variables

Howdy,
I've just started working with Installshield and have a few questions about variables. Essentially my installer has to check the registry for a couple of entries and then, depending on whether or not they're there, do something. Unfortunately, they are slightly dynamic, so I can't use the 'getRegistryValue' action. Instead, I came up with a custome event and some code that will do the searching for me. Here's the problem I'm having, how do I get a result out of the code and somewhere that my installer can see?

I found these examples in a few places:
arg0.getServices().getISDatabase().setVariableValue("variablename", "value") and
arg0.getWizard().getServices().getISDatabase().setVariableValue("variablename", "value")

and I'm trying to use the $V back in my beans to retrieve this value for some comparisions, but so far, the variable hasn't changed from the default value.

Oh, and I'm not sure if this matters, but I'm trying to do all of this in a custom event.

Thanks in advance

Leigh
Labels (1)
0 Kudos
(3) Replies
enanrum
Level 9

You can set your variable:

arg0.getServices().getISDatabase().setVariableValue("YOURVAR", value);

and get it anywhere in any custom event:

String var = arg0.resolveString("$V(YOURVAR)");

Regards,
Tom
0 Kudos
lmoulder
Level 3

Tom,
Thanks for the quick response. Unfortunately, it's still not working. I'm sure it's something minor and stupid that I'm forgetting to do, but I just can't seem to find it.

Here's the code that I'm using. I've parsed it down to almost nothing in hopes of getting it working.

package com.installshield.aratssl.event;

import com.installshield.database.ISDatabaseException;
import com.installshield.product.*;
import com.installshield.product.service.registry.*;
import com.installshield.wizard.*;
import com.installshield.wizard.service.*;
import com.installshield.event.wizard.*;

public class InstallScript extends WizardAction
{

public void onExecutingEWOSSCheckInstall(com.installshield.event.wizard.WizardActionContext arg0)
{

try
{
arg0.getServices().getISDatabase().setVariableValue("EWOSSInstalledFlag", "test");

}
catch (ServiceException e)
{
System.out.println(e.getMessage());
}
}
}

This is called in a custom event on it's 'On Executing Method' as part of the pre-install sequence. The next event in the sequence displays a text display where I have 'test $V(EWOSSInstalledFlag)' in the content field.

Everything seems to compile correctly, but when I run it, the text dialog says 'test default' (default is the default value i put into EWOSSInstalledFlag).

At this point I'm at a loss.

Leigh
0 Kudos
lmoulder
Level 3

Nevermind... I figured it out, and it bowls down to a stupid mistake.

Our build process is involked via an Ant script which starts with a template file and replaces a number of tokens and copies the new uip file into a build directory. All of the code I was updating was relative to the template file, and not the updated file, so the new file never saw any of my code. As soon as I copied over the CustomCode directory into this build directory everything started to work.

Thanks again Tom.

Leigh
0 Kudos