How to check if Microsoft Office is installed during an installation

We have added new conditions to Visual Installer’s script language that can be used to:

• check whether Microsoft Office is installed in the computer or not
• check if the installed Microsoft Office is 32 bit or 64 bit

This can be useful if you for example:

• install files that require that Microsoft Office is installed in the computer
• install files that require a specific bitness of Microsoft Office (for example 32 bit Office)
• want to install different files depending on the bitness of Microsoft Office

You can read more in this blog post:

> How to check if Microsoft Office is installed during an installation

Using the log function in Visual Installer’s script language

When using the script language in Visual Installer, it may sometimes be useful to see in detail what happen when the script lines are executed. To get detailed information about the execution of script commands, you can activate a log function in Visual Installer’s script language. When the log is activated, detailed information about every script line that is executed are stored in a log file. Here you can see the contents of the parameters that are passed to the script commands and see the return value (for example error codes) of every command. If you use variables in the script (for example %DESTDIR) you can see their actual values.

How to activate the log function
To activate the log function, you can use the USELOG script command. To enable the log, enter the following in the beginning of your script code:

USELOG 1

As default, the log file is stored in the main destination folder of the installation (the folder path that is stored in the %DESTDIR variable) but you can also specify your own folder for the log file via parameter 2. For example:

USELOG 1, C:\MyLogFolder

To turn off the log, somewhere in the script, you can enter the following:

USELOG 0

If you want to log all lines in the script, you don’t need to turn off the log at the end. It will be turned off automatically after the last executed script line.

In the picture below, you can see an example of how the USELOG command can be used:

USELOG

And below is an example of how the log file may look like:

Log (OK)

If a script command succeeds, it returns OK. Otherwise it returns ERROR and an error code. Below is an example of how the log file may look like if an error occurs:

Log (Error)

Most error codes can be found on this web page at Microsoft’s web site:

> Windows Dev Center: System Error Codes (0-499)

Some common error codes are:

2 : File not found!
3 : Path not found!
5 : Access denied!
183 : File already exists!

Filenames
The filename of the log file is Vinstall-Script–Before.log if the script lines are executed in the Before installation tab in the Execute script commands window in Visual Installer, and the filename is Vinstall-Script–After.log if the script lines are executed in the After installation tab in the same window. The filenames can not be changed, but you can change the folder where the log files are stored (as described above).

See also
> Visual Installer’s Scripting Language