Revenera Documentation site will be unavailable on July 2nd due to scheduled maintenance. For more information see the status dashboard.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
panamega
Level 4

Few IA questions

I'm new to IA and had a few questions I need help with:
1. Does IA allow you to modify xml files from within by specifying the element you want to change and query for its value using the UI etc (like you can in IS) or will you have to write custom code for this and call the code during the installation?
2. Also is writing code in java the only way to create custom panels in IA or does it allow you to do it internally by giving you a list of pre defined controls you can add and setting variables to accept their values?

Will be grateful if someone would help me with these
Labels (1)
0 Kudos
13 Replies
pv7721
Level 20

The answer to your second question is that there is no tool in IA that would allow visual creation of custom panels (I think that this is what you were looking for, right?) So I'm afraid you will need to write custom code for any custom panel that you need to create.
0 Kudos
scully13
Level 4

For question #2 it does have 2 panels that you can semi-customize. Like during the pre-install you can use the Advanced or Simple Get User Input panels. Then you can plug in what type of controls they should be. The variables to use and the text to display. Then you use a variable that you choose to read in the values set.
0 Kudos
panamega
Level 4

Thanks a lot for the replies. The Get User input advanced seems to be enough for my UI needs. But I want the values entered in the textfields to be added into an xml file which forms part of the installation package.
Is there anyway I can do this from within IA itself or will I have to write custom code for it? Also is it possible to pass the results of the textfields from the UI to the code I will have to write
0 Kudos
pv7721
Level 20

The answers entered in the fields are stored in IA variables which you can access within your code, but I'm not sure that there are built-in actions for writing them in XML files.
0 Kudos
panamega
Level 4

Ok as a prelude to that xml program I was talking about I wrote a simple java prog to take values of variables from IA (from a custom panel) and write them into a text file which forms part of the installation package. But after the installation is done and when I open the text file I get some weird characters before the actual value.
For instance, if I had entered IA during the installation, it gets stored as '’ t IA' in the text file. What could be wrong here??

The code is as below:

import java.io.*; 
import com.zerog.ia.api.pub.*;


public class writetofile extends CustomCodeAction
{

public void install(InstallerProxy ip) throws InstallException
{

String str=ip.substitute("$USER_INPUT_RESULT_1$");
//String str=(String)ip.getVariable("$USER_INPUT_RESULT_1$");
String str2=ip.substitute("$USER_INSTALL_DIR$");
String fileaddr=str2+"\\Installed Files\\out.txt";



try{
FileOutputStream fos=new FileOutputStream(fileaddr);
ObjectOutputStream out=new ObjectOutputStream(fos);
out.writeObject(str);
out.flush();
fos.close();
}
catch(IOException e)
{}

}

public void uninstall(UninstallerProxy uninstallerproxy)
throws InstallException
{
}



public String getInstallStatusMessage()
{
return "";
}


public String getUninstallStatusMessage()
{
return "";
}

}
0 Kudos
panamega
Level 4

I redid the above program to write the IA variables to corresponding xml elements in an xml file and the values seem to be entered just fine. It must be something in the file handling code above. Or if it's cause of something else, always feel free to tell me 🙂
0 Kudos
panamega
Level 4

How do I make the text fields created with 'Get User Input Advanced' action mandatory? Like it should either display a message if I try to go over to the next panel leaving the fields empty or the 'Next' button should be disabled till all the fields have been filled.
0 Kudos
pv7721
Level 20

What I do is that right after the panel I add a small custom code that reads the values from all the IA variables that need to be filled. If at least one is null, I set another IA variable, say $RETRY_GET_USER_INPUT$ to true, and I use the Show Message Dialog based on the rule that $RETRY_GET_USER_INPUT$ is true, that would display a message to the user, for instance "Not all the required fields were fileld", with a single Ok button, that would return it to the Previous panel.
0 Kudos
panamega
Level 4

I did what you advised above but doesn't seem to work in my case. Here's the code i wrote
import java.io.*; 
import com.zerog.ia.api.pub.*;


public class verify extends CustomCodeAction
{

public void install(InstallerProxy ip) throws InstallException
{

//boolean var=true;

String var="true";

String str=ip.substitute("$USER_INPUT_RESULT_1$");
String str2=ip.substitute("$USER_INPUT_RESULT_2$");

if(str=="")
{
ip.setVariable("$VERIFY$", var);
}

if(str2=="")
{
ip.setVariable("$VERIFY$", var);
}





}

public void uninstall(UninstallerProxy uninstallerproxy)
throws InstallException
{
}



public String getInstallStatusMessage()
{
return "";
}


public String getUninstallStatusMessage()
{
return "";
}

}


In pre-install task, just before the custom panel I chose the set variable action and set its value to false. Below the custom panel I put in the custom code and below that the message dialog with a compare variables rule.
0 Kudos
pv7721
Level 20

Can you post your project?
0 Kudos
panamega
Level 4

please check the attachment.
0 Kudos
scully13
Level 4

Couldn't you also just use the user input result variables and check those in the Rules of your Show Message Dialog. Add 2 "Compare InstallAnywhere Variables" rules and change the AND to OR at the top. The first rule will check $USER_INPUT_RESULT_1$ equals and the second rule will check $USER_INPUT_RESULT_2$ equals . This way you should'nt need the custom code. If either variable is empty it keeps them on that dialog and shows your message.
0 Kudos
panamega
Level 4

Yep that worked! Thanks a heap
0 Kudos