Detect Office version. - Advanced Installer Community

We’re moving our forums to a new platform.

You can still browse and search existing topics, but you can no longer create new topics or post replies.

For questions, technical issues, or feature requests, please don’t hesitate to contact our support team at support@advancedinstaller.com.

Thank you for your understanding!

rashdanraees
Posts: 2
Joined: Thu Jun 25, 2009 1:33 pm

Detect Office version.

Hi!
I have a vbs file , in which I check which office version is installed on the clients machine, and then accordingly i have different files, if office 2007 then dotx files, else dot files. But I don't know how can I add this vbs file to the msi package I'm creating, please please help me, its urgent as I need to finish it as soon as possible,. tell me how can I add this file to the installer.

Regards.
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Re: Detect Office version.

Hi,

The .VBS file can be added as a New Attached Custom Action in the Custom Actions page. If you want it to access installer properties it should be scheduled as Immediate. Inside the custom action you can set a custom installer property which can then condition the components of the files in the Organization page.

In VBScript an installer property can be set like this:

Code: Select all

Session.Property("PROPERTY_NAME") = value
Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
rashdanraees
Posts: 2
Joined: Thu Jun 25, 2009 1:33 pm

Re: Detect Office version.

HI!
i din't get really what you told me to do, the reason is this is my first time I'm using this software and making an MSI, please help me little in detail, can you please tell me the exact code that should be added, this is what I have coded to check the version number

officepath="C:\Program Files\Microsoft Office\Office11\"
set fso=createobject("scripting.filesystemobject")
returnstring=fso.getfileversion(officepath & "winword.exe")
wscript.echo returnstring
set fso=nothing

please tell me, what to do now to make the installation copy the right files. your help will be highly appreciated, I'm kinda newbie to making installation packages.

Regards.
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Re: Detect Office version.

Hi,

I'm afraid we don't have sample code for what you need to do. However, you can try this approach:
- create a search for "winword.exe" (this is more reliable than using a hard-coded path)
- the name of the search is actually an installer property which will contain the result of the search, so inside your custom action you can retrieve the "winword.exe" path
- after retrieving the version of "winword.exe" you can set a custom installer property
- this property can be used to condition the files

The code can look like this (I didn't test it, so you may need to adjust it):

Code: Select all

Dim winWordPath
winWordPath = Session.Property("WINWORD_PATH")
set fso = createobject("scripting.filesystemobject")
officeVersion = fso.getfileversion(winWordPath)
If officeVersion = 11 Then
  Session.Property("OFFICE_VERSION") = "11"
End If
If officeVersion = 12 Then
  Session.Property("OFFICE_VERSION") = "12"
End If
This code can be pasted into a .VBS file which can be added as a New Attached Custom Action. To run it at the beginning of the installation you can scheduled it under the "InstallExecuteSequence" -> "CostFinalize" standard action.

After this custom action runs the OFFICE_VERSION property should be set to "11", "12" or to an empty value. This property can now be used in the Organization page to condition the components of the files you want. The components which should be installed only for Office 2003 can use the condition:

Code: Select all

OFFICE_VERSION = "11"
he components which should be installed only for Office 2007 can use the condition:

Code: Select all

OFFICE_VERSION = "12"
Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”