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

Getting your current version

Is there a way using the InstallShield APIs to get the current version that is being installed? I tried using $P(.key.version.major).$P(.key.version.minor) as Robert Dickau suggested in aother post but that doesn't seem to work for me.
Labels (1)
0 Kudos
(2) Replies
RobertDickau
Flexera Alumni

As a quick test, this wizard action seems to do it:
import com.installshield.wizard.*;
import com.installshield.wizard.service.*;
import com.installshield.product.*;
import com.installshield.product.service.product.*;

public class GetVersionTest extends WizardAction
{
private static final String SRC = ProductService.DEFAULT_PRODUCT_SOURCE;

public void execute(WizardBeanEvent event)
{
try
{
ProductService ps = (ProductService)getService(ProductService.NAME);
String rootbeanid = ps.getProductTreeRoot(SRC);

SoftwareObjectKey rootsok =
(SoftwareObjectKey)ps.getProductBeanProperty(
SRC, rootbeanid, "key");

SoftwareVersion sv = rootsok.getVersion( );

javax.swing.JOptionPane.showMessageDialog(null,
sv.getMajor( ) + "." +
sv.getMinor( ) + "." +
sv.getMaintenance( ));

} catch(ServiceException drat) { drat.printStackTrace( ); }
}
}
0 Kudos
Jennell_Little
Level 3

That was exactly what I needed. It works great. Thanks!
0 Kudos