Phil

Need to get user input

Hi, I saw a recent message about people wanting to get user input.

I need to get a server IP address and/or machine name, also pick a source directory for some data.
Seems like the only real way to do this is to hack the MSI installer manually (i.e it cannot be done with Advanced Installer)? Having my own dialog do this would be possible, but then I'd need to put in some effort to duplicate the appearance of the rest of the installer. Or have I missed something??

Is there any intention to put this support in? Because it'd be really useful (imho).

Thanks
Phil
UdreaMihai
Posts: 90
Joined: Wed Mar 23, 2005 8:13 am

Hi Phil,

It is a bit more difficult to create a Windows Installer dialog. We are preparing to support it in AI, but it will take a while.

In the meantime, you may prefer to use a custom action that just produces an input box or a more complex dialog.

Hope it helps.

Best regards,
Mihai.
Udrea Mihai
Advanced Installer Team
http://www.advancedinstaller.com
Phil

Thanks for the reply.
...use a custom action that just produces an input box or a more complex dialog...
Can you tell me where I can see an example of this? I've been looking at 'Custom Actions' but I can't quite figure out how I produce an 'input box'. Or do I need to do this in a separate exe that the custom action specifies?

What I'm trying to acheive is this:
a) create a 'professional' project
b) install a JRE as a prerequisite
c) install our application (already built with jexepack)
d) ask the user for a data directory
e) run a database migration where we're importing data from the location specified in (d).

Do you have any recommendations on this and also the earlier question (an example of an 'input box' in use)?

Thanks
Phil
UdreaMihai
Posts: 90
Joined: Wed Mar 23, 2005 8:13 am

Hi,

Here a script that creates a property (MYPROP) with a value set by the user:

Dim Input
Input = InputBox("Enter your name")
Session.Property("MYPROP") = Input

From a text editor create a vbscript file that contains these lines.

In Advanced Installer's Custom Action page you can place programs to be launched during the install.

Select a item from the "Install Sequence" list and use the "New Attached Custom Action" button to select your vbscript file.
Use "Synchronous execution, ignore return code." option.
You may also prefer the "Immediate Execution" option.

After this custom action you must place your other custom action that does the data migration that you are taking about using the location store in that previously set MYPROP property.

Best,
Mihai.
Udrea Mihai
Advanced Installer Team
http://www.advancedinstaller.com
Cata
Posts: 638
Joined: Thu Apr 10, 2003 7:37 am
Contact: Website

Hi Phil,

You should use a project of Java type. That will allow you to define "Java products" which are EXE files. On them you can specify Icons, Version strings, names, description, etc.

Those files can also be used as Custom Actions during install, so your Java code can be called for asking the user for a directory and importing the data.

Hope that helps,
Cata
Catalin Rotaru - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
Phil

UdreaMihai wrote: Dim Input
Input = InputBox("Enter your name")
Session.Property("MYPROP") = Input

From a text editor create a vbscript file that contains these lines.
ah, lol ! I've never written a line of vbscript in my life and I don't intend start now! But I seem to recall there were other options (sorry, not at my work PC), eg javascript...?

But it's the general technique and approach that I was looking for...
Thanks for the tip
Phil
Phil

Cata wrote:You should use a project of Java type. That will allow you to define "Java products" which are EXE files. On them you can specify Icons, Version strings, names, description, etc.
I did originally start with a java type project, but there were some problems: (a) it created an exe but it didn't have our icon on it; (b) after installing I tried double-clicking the exe but nothing happened; (c) I wasn't too happy to see the default target class (and some other settings) in plain text in an ini file alongside the exe; (d) although I turned off obfuscation during this testing, I was suspicious of whether the ini file would find the default target class if I'd left it on.
I also found it confusing/unclear as to the selection of JRE to go along with the application; and if the user does not yet have a JRE, how do I attach one (which I already have the installer for)?
Since we already have an exe 'wrapper' for our jar (using jexepack, which is already integrated into our ant script), I saw no reason to have AI repeat this.
Those files can also be used as Custom Actions during install, so your Java code can be called for asking the user for a directory and importing the data.
That would be useful, but does this not mean that part-way through the install sequence (with nice AI forms), we'd have one of our own forms popping up? And to avoid it looking out of place we'd have to put some work into reproducing (i.e. mimic) the appearance of the AI forms? This seems awkward.

Thanks again,
Phil
Cata
Posts: 638
Joined: Thu Apr 10, 2003 7:37 am
Contact: Website

Hi Phil,

Just to make sure the Java Project issues are/will be fixed for other users as well, you don't need to use it if you're 100% happy with your current setup:
(a) it created an exe but it didn't have our icon on it
That is the case by default, but you can easily specify an icon in the Java Products > Product Setting page by clicking on the "..." button next to the Icon Path field.
(b) after installing I tried double-clicking the exe but nothing happened
Not good. Are you sure the Class Path and Main Class were well defined?
c) I wasn't too happy to see the default target class (and some other settings) in plain text in an ini file alongside the exe
True, that is a feature we don't have.
d) although I turned off obfuscation during this testing, I was suspicious of whether the ini file would find the default target class if I'd left it on
You can't ofuscate the *name* of the main class of a Java program, no matter how you launch it, because the launcher has to be able to find it somehow.
also found it confusing/unclear as to the selection of JRE to go along with the application; and if the user does not yet have a JRE, how do I attach one (which I already have the installer for)?
Two ways:
a) Specify the JRE as a prerequisite in the Media page. It will be downloaded and installed if not found already installed on the target computer.

b) Bundle the JRE in the install. Also from the Media page.
That would be useful, but does this not mean that part-way through the install sequence (with nice AI forms), we'd have one of our own forms popping up? And to avoid it looking out of place we'd have to put some work into reproducing (i.e. mimic) the appearance of the AI forms? This seems awkward.
Yes, I am afraid this is currently the case. We are working on supporting user-defined dialgos in install, but they will take a while longer.

Custom Actions are the work around until then. But the good news is that they don't have to be written in VBS. JS or any EXE/DLL work too. You can write them even in Java, if you then define an EXE Java product and call it from the CA.

Cata
Catalin Rotaru - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
Phil
Posts: 22
Joined: Sat Aug 27, 2005 3:47 am

Cata wrote:Hi Phil,
You should use a project of Java type. That will allow you to define "Java products" which are EXE files. On them you can specify Icons, Version strings, names, description, etc.

Those files can also be used as Custom Actions during install, so your Java code can be called for asking the user for a directory and importing the data.

Cata
Ok, I've created a small jar containing a utility to perform spcial tasks during installation (eg update cfg files). Can I create a 'java product' without installing it?
I.e I only need this small utility during installation. To create the 'java product' I added the jar to my 'Files and Folders' section; how do I prevent that jar from being installed?? The jar has been installed, as has the 'java product' exe (I even tried setting 'Run from source only' under features and components), but I don't want them installed.

Another big problem - I tried running the installed 'java product' exe and nothing happens. Can I run this with some sort of console option (or command-line switch) so I can see error messages? I changed the 'java product' application type to a 'console' application and sure enough, there were the errors... is there a way to do this without changing the application type?

Thanks
Phil
Posts: 22
Joined: Sat Aug 27, 2005 3:47 am

Phil wrote: Ok, I've created a small jar containing a utility to perform spcial tasks during installation (eg update cfg files). Can I create a 'java product' without installing it?
Ok, I figured out that I could create a Feature (and move the utility to this), and set the Feature to be never installed. But then I've tried adding a custom action in the install section, and I get this error when I run the installer:

The installer has encountered an unexpected error installing this package. This may indicate a problem with this package. The error code is 2753.

I noticed that if I DO install this temporary utility then the problem does not occur. Is my custom action set up wrong?
Phil wrote:Another big problem - I tried running the installed 'java product' exe and nothing happens. Can I run this with some sort of console option (or command-line switch) so I can see error messages?
Oh, I took a hunch that the JVM wrapper that AI uses is similar to JExePack, and happy to see that I could do this to get the console output:

Code: Select all

MyProg.exe -E* >output.txt
:)

Anyway, any ideas on how to run my java utility (without installing it) greatly appreciated. Thanks in advance
Mike
Posts: 292
Joined: Wed Jun 01, 2005 10:50 am
Location: Craiova, Romania
Contact: Website

Hi,

I'm afraid this is not supported. If you are using a java application this needs to be an "Installed custom action". If it was a single file (the EXE) you could make it an "Attached custom action". A workaround: if you don't want those files in the installation folder, you could schedule another custom action to delete those files, after they are no longer needed.

Your custom action is not set up wrong, it just tries to execute a file that has not been deployed.

Regards,
Mihai
Mihai Bobaru
Advanced Installer Team
http://www.advancedinstaller.com
Phil
Posts: 22
Joined: Sat Aug 27, 2005 3:47 am

Mike wrote:If it was a single file (the EXE) you could make it an "Attached custom action".
Ok, that is the answer then I'll make any of these applications exe's first with our normal exe wrapper (which I can integrate into ant). This'll simplify things; I haven't had much success with custom actions :?

Thanks

Return to “Common Problems”