Need to create a secondary file installer.

Got a problem you cannot solve? Try here.
jmaeir
Posts: 5
Joined: Thu Jun 29, 2017 10:46 am

Need to create a secondary file installer.

Postby jmaeir » Wed Jul 05, 2017 2:35 pm

Hi Guys,

I'm looking for input on how to get the following goal done.
The installer is a supplemental one that is run after the main installer that installs our application is run.
This installer needs to install a set of folders and the xml files in them to the location C:\Users\Public\Documents\MyCompany

The trick here is that these are configuration files that are used by the application and our customers can modify them.
If any of the files that are being installed already exists and is newer than the file in the installer, we would like to ask the user if they want to overwrite or make a backup copy of the file.

Please advise if and how this can be done in the InstallAware scripting.

Thank you!

Josh.

FrancescoT
Site Admin
Posts: 5361
Joined: Sun Aug 22, 2010 4:28 am

Re: Need to create a secondary file installer.

Postby FrancescoT » Thu Jul 06, 2017 5:24 am

Dear Josh,

by default the behavior is to overwrite files on the target system only if the ones you are copying are newer. This behavior cannot be changed with the Windows Installer engine and in case that a file gets overwritten, the Windows Installer engine doesn't display any prompt to the user.

Due of this, to achieve your requirement you may use a simple installer based on InstallAware Native Engine.
"InstallAware includes a native code setup engine beginning with InstallAware version 10. The native engine complements Microsoft's Windows Installer setup engine and provides faster execution speeds and greater flexibility at runtime."
* for more details please consult the InstallAware documentation.

For your purposes, you may create a very minimal project project based on the "Blank" project template. A blank project is just an empty project. By default, a Blank Project doesn't include any setup dialog or other resources and it doesn't create any MSI file ...so, it's just a "blank" script that can be used to execute a series of commands over the target machine.

For example;

Code: Select all

Set Variable NATIVE_ENGINE to TRUE
Set Variable NATIVE_OVERWRITE to PROMPT
Set Variable NATIVE_OVERWRITE_OLDER to TRUE
 
Set Variable ALLDOCUMENTS to
Get Common Folder Location My->My Documents into ALLDOCUMENTS
 
Set Variable MY_TARGET_DIRECTORY to $ALLDOCUMENTS$\MyCompany
 
Install Files ...MyFile.xml to $MY_TARGET_DIRECTORY$

Or, in ready to paste form:

Code: Select all

~InstallAware Clipboard Data~
~Install Files~
~{F8CA5C91-E5E5-4E43-A062-4E763AE52B63}~
~...MyFile.xml~
~FALSE|~
~$MY_TARGET_DIRECTORY$~
~FALSE~
~FALSE~
~FALSE~
~FALSE~
~FALSE~
~FALSE~
~FALSE~
~FALSE~
~FALSE~
~Comment~
~{CF66432B-9B04-400E-BF22-73C89D13AE7D}~
~~
~Set Variable~
~{8565D625-7639-46A9-B5E9-902201733D27}~
~MY_TARGET_DIRECTORY$MYAH$MYAH$FALSE~
~$ALLDOCUMENTS$\MyCompany~
~Comment~
~{25B67FE2-2E4A-4422-85CB-A61E19B12E9F}~
~~
~Get Folder Location~
~{8BD6B3A2-FB19-4B2D-A8CC-DC8427FEAC7D}~
~ALLDOCUMENTS~
~2~
~TRUE~
~Set Variable~
~{3C8BBE1F-4D89-4D94-BDA8-71CB0DD4C55C}~
~ALLDOCUMENTS$MYAH$MYAH$FALSE~
~~
~Comment~
~{93DC89BE-730F-48AC-946B-904132FC9AA2}~
~~
~Set Variable~
~{13993565-B7E9-4561-8103-393E1A80F1C3}~
~NATIVE_OVERWRITE_OLDER$MYAH$MYAH$FALSE~
~TRUE~
~Set Variable~
~{039A0604-7EE7-450D-9519-D0734D01D164}~
~NATIVE_OVERWRITE$MYAH$MYAH$FALSE~
~PROMPT~
~Set Variable~
~{3F26EB0E-6EBE-40C9-AA0D-53B68FF08BED}~
~NATIVE_ENGINE$MYAH$MYAH$FALSE~
~TRUE~

The above sample code uses "NATIVE_OVERWRITE" and "NATIVE_OVERWRITE_OLDER" (pre-defined variables) to control the NATIVE ENGINE behavior when overwriting a file on the target system. In this specific case, the end-user will be prompted with an overwrite dialog displaying the file dates and versions for both the new file and the old file, as well as the options to overwrite or skip the file.
* for more details about "Native Engine pre-defined variables", please consult the InstallAware documentation.

The above sample is just a very simple script. This just executes a series of script commands and it doesn't install any package on the target machine (the package will be not listed in ARP). Of course you can modify it as you prefer (eg, you may include setup Dialogs and so on).

To make make a backup copy of the existing files, you may use the "Does File/Folder Exist" command in combination with the "Copy/Move Local Files" command.

Hope this helps you.

Regards
Francesco Toscano
InstallAware Software

White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Publications - http://www.installaware.com/publications-review.htm
InstallAware Help -F1 anywhere in the InstallAware IDE


Return to “Technical Support”

Who is online

Users browsing this forum: Google [Bot] and 28 guests