This website uses cookies. By clicking Accept, you consent to the use of cookies. Click Here to learn more about how we use cookies.
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
- Revenera Community
- :
- InstallShield
- :
- InstallShield Forum
- :
- Working with variables
Subscribe
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎May 30, 2006
07:48 PM
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
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
(3) Replies
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎May 31, 2006
08:52 AM
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
arg0.getServices().getISDatabase().setVariableValue("YOURVAR", value);
and get it anywhere in any custom event:
String var = arg0.resolveString("$V(YOURVAR)");
Regards,
Tom
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎May 31, 2006
01:00 PM
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
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
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎May 31, 2006
01:52 PM
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
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