PDA

View Full Version : Custom Events and Install Dir



jamespauly
06-01-2004, 03:09 PM
I building a custom event and I am trying to get the Install Dir inside of the Custom Event but all attempts have failed. Notice the $D(install) below. I have also tried resolveString($D(install)) and still no luck.

package com.installshield.sonicftp.event;

import java.io.*;
import java.net.*;
import com.installshield.event.*;
import com.installshield.event.ui.*;
import com.installshield.event.wizard.*;
import com.installshield.event.product.*;
import com.installshield.wizard.*;
import com.installshield.wizard.service.*;
import com.installshield.wizard.awt.*;
import com.installshield.wizard.swing.*;
import com.installshield.wizard.console.*;
import com.installshield.product.*;
import com.installshield.product.ProductBean;
import com.installshield.util.*;
import com.installshield.ui.controls.*;
import com.installshield.database.designtime.*;

public class InstallScript
{

public void onExecutingrunSonica7bc885a92a478943a29fd4393c38a5f(com.installshield.event.wizard.WizardActionContext arg0)
{
Runtime run = Runtime.getRuntime();
String installDir = $D(install);
try {

System.out.println(installDir);

java.lang.Thread.sleep(6000);
Process pro = run.exec("java -Dsonicsw.install.target=" + installDir + " -Dsonicsw.install.setup.ini=" + installDir + "\\setup.ini -jar " + installDir + "\\setup.jar -silent");
System.out.println(pro.toString());
}
catch(java.lang.Exception e){}
}
}

Mike_W
06-01-2004, 03:13 PM
James,

Please try resolveString("$D(install)");

Notice the quotations around $D(install).
Let me know if that was your problem.

Mike

jamespauly
06-01-2004, 03:16 PM
No luck when I tried that I get the following error.

Error in InstallScript.java on line 26: cannot resolve symbol Class Compiler
symbol : method resolveString (java.lang.String) Class Compiler
location: class com.installshield.sonicftp.event.InstallScript Class Compiler
String installDir = resolveString("$D(install)"); Class Compiler
^ Class Compiler
1 error Class Compiler


I'm unsure what this is exactly telling me

Mike_W
06-01-2004, 03:26 PM
My first solution was incorrect. The resolveString method is a method of the WizardBean class. You can access it through the context parameter passed into your custom event.


String installDir = arg0.getWizard().getCurrentBean().resolveString("$D(install)");

Hope this helps,

Mike

jamespauly
06-01-2004, 03:30 PM
Thanks much that solved the problems. I was overlooking the arg0 object thinking it was inherent.

My mistake.

Thanks