borislaa
Posts: 16
Joined: Wed Oct 05, 2005 11:35 pm
Location: Nice, France

Copy a File in directory that is a Target Env Variable

Hello,
is it possible to put a file in a folder on the target machine that is known by env variable?
For exemple: If I know that on the target machine exists the env variable
JAVA_HOME and I want to put some files into or to create a new folder into!
Is it possible and if yes, can you tell me how?
I never used VBScript ...
I can create a .bat file, but how create an .exe from and launch it?

Thanks in advance
Alexandre
Mike
Posts: 292
Joined: Wed Jun 01, 2005 10:50 am
Location: Craiova, Romania
Contact: Website

This is possible by using a Property Set With Formatted type of custom action.

Here are the necessary steps:

1. Create a new property in the "Install Parameters" tab, called say MyDir.

2. Go to the "Custom Actions" page. Under the InstallExecuteSequence->Begin branch create a "Property Set With Formatted" type of custom action. Set the value [%JAVA_HOME] for the MyDir property.

3. Share this CA to the Begin branch in the "InstallUISequence". Set it to run only once if present in both sequence tables.

4. Use a property based folder to place the files you want in the folder given by JAVA_HOME.

These are the necessary steps. However, there is the issue what happens if this environment variable is not present on the target system? Of course, the property could have a default value, but this is not a solution.

What is the thing are you trying to accomplish? Maybe there is a better way.

Regards,
Mihai
Mihai Bobaru
Advanced Installer Team
http://www.advancedinstaller.com
borislaa
Posts: 16
Joined: Wed Oct 05, 2005 11:35 pm
Location: Nice, France

Hello Mike and thanks a lot for your answer :))

I tried to make all of your instructions, but I think I do something wrong:
1. I created a new propery in "Install Parameters" called MyDir, but I must associated a value to this property ... so tried to put [%JAVA_HOME],
a string "a", [%JAVA_HOME%], but the installer tell me : Network device not found or something

2. In the InstallExecuteSequence->Begin I created Property Set With Formatted and in the Property name I put MyDir and in Formatted Text field I put [%JAVA_HOME]

3. I did the same in InstallIUSequence->Begin and I selected "Execute only once if present in both ..."

4. I put files in the property based folder, but I have the problem : Network device not found ...

I tried to do a lot of solutions but no result ...

In fact I must evaluate this Installer for my company and if its possible to do some manipulations with we will buy it.
I must create msi package that will be installed after the installation of ARM Tools (on a separate CD-ROM). So I am sure that some env variables will exists on the target computer! During the installation I must put some conf files in folders known under env variables (setted by installer ARM)
Thanks
Mike
Posts: 292
Joined: Wed Jun 01, 2005 10:50 am
Location: Craiova, Romania
Contact: Website

Hi,

You don't need to specify any value for the property. Just leave the default value "Your Value".

You shouldn't create two separate custom action. Just create one, in one of the places I told you, and then drag it pressing the SHIFT key to the other location. The custom action is now shared between the two sequences. Set it's properties to run only once.

The end value for the MyDir property should be a valid *absolute* path, otherwise that error will occur. You can check for debug the value of the Mydir property by scheduling an inline script CA, after the Property Set With Formatted CA in InstallExecuteSequence.

Here is the code to display the property value:

Code: Select all

MsgBox Session.Property("MyDir")
Of course, for the install to work on your machine, the JAVA_HOME environment variable must be present. It's value should be a valid absolute path.

Hope this helps. If you continue to experience problems, contact me at support at advancedinstaller dot com and I can send you a working example.

Regards,
Mihai
Last edited by Mike on Tue Oct 25, 2005 8:14 am, edited 1 time in total.
Mihai Bobaru
Advanced Installer Team
http://www.advancedinstaller.com
borislaa
Posts: 16
Joined: Wed Oct 05, 2005 11:35 pm
Location: Nice, France

Thank you so much. It's working now.
Its powerfull this tool :)
borislaa
Posts: 16
Joined: Wed Oct 05, 2005 11:35 pm
Location: Nice, France

Hi Mihai,

My company is finally bought your product and I am very satisfied of the result of the installer that I created with! :)

I would like to perform an action now but I am not sure to can do it:
I must display an error message if the env variable that I need is not present in the target machine:
I created an "Error Message" as "New custom action" in "Begin" sequence, but I dont know the synthax to use in "Execution Condition" field ...
I wrote
Session.Property("XXX_HOME")="Your Value"
and
[XXX_HOME]=="Your Value"
but I have an error while execute the installer: the error code is 2717
Can you help me please?
Thank you in advance
Alexandre
borislaa
Posts: 16
Joined: Wed Oct 05, 2005 11:35 pm
Location: Nice, France

Hi,

I justed saw on the Microsoft web site:
http://msdn.microsoft.com/library/defau ... syntax.asp
I tried with entering in the condition field:
NOT %XXX_HOME
but it still not working ... I havn't an error but when the variable XXX_HOME is not defined the error message is not displayed ... the condition is always true ...

So problem is still not resolved ...
Mike
Posts: 292
Joined: Wed Jun 01, 2005 10:50 am
Location: Craiova, Romania
Contact: Website

Hi,

If the environment variable is not present on the target computer the "Property Set with Formatted" custom action will leave the old value of the property unchanged. So, the solution is simple.

After the Property Set with Formatted" custom action in the InstallExecuteSequence, you can schedule an "Error Message" type of custom action. It should run if the property still has the default value. The condition should be:

Code: Select all

XXX_HOME = "Your Value"
All the best,
Mihai
Mihai Bobaru
Advanced Installer Team
http://www.advancedinstaller.com
borislaa
Posts: 16
Joined: Wed Oct 05, 2005 11:35 pm
Location: Nice, France

Ok , thanks
In fact if the env variable is not found the empty string is affected to my XXX_HOME variable. So
XXX_HOME="Your Value" OR XXX_HOME=""
is the condition that works fine.

Thank you so much :D
borislaa
Posts: 16
Joined: Wed Oct 05, 2005 11:35 pm
Location: Nice, France

Not expected behaviour on a different target PC

Hello,

My msi file worked fine until today on all pc in the office. But today I tested on a pc where I observed strange behaviour:
On the target machine the expected env variables are present, but when the installation finish I haven't the files where I expect. Usual behaviour (on most pc):

Code: Select all

%XXX_VAR%/files
My behaviour (on one pc for the moment):

Code: Select all

[APPDIR]\XXX_VAR\files
where APPDIR is the folder where my application is installed, %XXX_VAR% is the value of the env variable with this name, XXX_VAR is the name of the env variable ...

What can be the problem? Windows Installer version not up to date?? or ...?
Thanks for your advice :roll:
Mike
Posts: 292
Joined: Wed Jun 01, 2005 10:50 am
Location: Craiova, Romania
Contact: Website

Hi,

The AI generated MSI might not work correctly if the Windows Installer on that machine has a version less than 2.0. For more information on this please visit:

http://www.advancedinstaller.com/requirements.html

I assume you have upgraded to a newer version of Advanced Installer. Did the problem appear after you have upgraded? If so, does the MSI still works on the machines where it was successfully tested? I want to rule out the possibility of a bug in the upgraded version.

Hope this helps.

If the problem persists please send the AIP file to support at advancedinstaller dot com.

Regards,
Mihai
Mihai Bobaru
Advanced Installer Team
http://www.advancedinstaller.com
borislaa
Posts: 16
Joined: Wed Oct 05, 2005 11:35 pm
Location: Nice, France

Hello,

I will check the version of Windows Installer (I dont have access to the problematic PC every day ...), but normally I think that it might be 3.1.
The automatic upgrade of Windows is scheduled for all pc in the office, so I think that the version is 3.1, but I'm not sure ...

The problem appears with a msi file created with the old version of Advanced Installer, so it's not related to the new version.

There is something else - my old condition
XXX_HOME="Your Value" OR XXX_HOME=""
is not more Valide when I push Validate button for the condition ...
But if I dont modify it, it works with the old synthaxe...

Best Regards
Mike
Posts: 292
Joined: Wed Jun 01, 2005 10:50 am
Location: Craiova, Romania
Contact: Website

Hi,

You are right. The expression is valid.

There is an error in the validation procedure. We will fix it. Thank you for signaling this issue to us.

Regards,
Mihai
Mihai Bobaru
Advanced Installer Team
http://www.advancedinstaller.com

Return to “Common Problems”