itmanager8815
Posts: 6
Joined: Tue Apr 10, 2012 7:23 pm

Support for vbs scripts

Tue Apr 10, 2012 7:26 pm

Does the free version of Advanced Installer (using a Simple project) support execution of vbs scripts before or after installation? I see there is an option for Launch Conditions and the ability to add a new condition but some of the options are disabled.

Daniel
Posts: 8237
Joined: Mon Apr 02, 2012 1:11 pm
Contact:  Website

Re: Support for vbs scripts

Wed Apr 11, 2012 8:15 am

Hi,

Our "Freeware" version of Advanced Installer, as you can see in our features list, doesn't implement "Custom Actions" feature that includes execution of VBScript. If you need this you must have at least a "Professional" version of Advanced Installer.
You can upgrade your Advanced Installer version from our Purchase page.

Regards,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

itmanager8815
Posts: 6
Joined: Tue Apr 10, 2012 7:23 pm

Re: Support for vbs scripts

Wed Apr 11, 2012 6:25 pm

Thanks Daniel. I am testing the Professional edition now.

My problem now is that the .vbs script does not recognize the install directory as indicated in Advanced Installed. I am using the script below. The value of Session.Property("INSTALLDIR") is being set to "C:\Program Files (x86)" even though I have specified "C:\Program Files". The Application Folder is set to "[ProgramFiles64Folder]xxx" where "xxx" is the product name. Is there another variable I need to use to indicate the path?

dim wshFSO : Set wshFSO = CreateObject("Scripting.FileSystemObject")
dim wshShell : Set wshShell = CreateObject("WScript.Shell")
dim wshSysEnv : Set wshSysEnv = wshShell.Environment
dim wshPrcEnv : Set wshPrcEnv = wshShell.Environment("Process")

dim strSysFolder : strSysFolder = wshSysEnv("windir")

strSysFolder = Replace(strSysFolder, "%SystemRoot%", wshPrcEnv("SYSTEMROOT"), 1, -1, vbTextCompare)

Dim sInstalldir
sInstalldir = Session.Property("INSTALLDIR")

Dim sFile

'register and load the service
sFile = strSysFolder & "\Microsoft.NET\Framework64\v4.0.30319\installutil.exe"

If Not wshFSO.FileExists(sFile) Then
MsgBox "The file " & sFile & " does not exist. Please make sure that .NET v4.0 is installed on your machine. Installation incomplete."
Else
RunMe = sFile & " " & """" & sInstallDir & "bin\services.exe" & """"

return = wshShell.run("cmd /K " & RunMe,,true)
'MsgBox "Business Services installed"
End If
Last edited by itmanager8815 on Fri Apr 27, 2012 5:39 pm, edited 1 time in total.

Daniel
Posts: 8237
Joined: Mon Apr 02, 2012 1:11 pm
Contact:  Website

Re: Support for vbs scripts

Thu Apr 12, 2012 8:02 am

Hi,

As you can see in our article Packages Types the "ProgramFiles64Folder" from a 32 bit package is resolved to "C:\Program Files (x86)\" location on a 64-bit platform.

Please keep in mind that if you want the "ProgramFiles64Folder" to be resolved to "C:\Program Files\" location on a 64-bit platform then you should use a "Mixed 32/64-bit matching the platform" package type or a "64-bit" package type.

Let us know if this helps, otherwise please give us more details about your scenario.

Regards,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

itmanager8815
Posts: 6
Joined: Tue Apr 10, 2012 7:23 pm

Re: Support for vbs scripts

Fri Apr 27, 2012 5:28 pm

We are back testing this. The install package was built using a 64 bit package. When the .vbs script executes, it substitutes the path as follows:

C:\Windows\SysWOW64\bin\....

instead of the application installation directory, which should be:

C:\Program Files\application\bin...

The application does get installed to the correct directory, it is the path to that directory that is not being substituted properly in the .vbs script.

itmanager8815
Posts: 6
Joined: Tue Apr 10, 2012 7:23 pm

Re: Support for vbs scripts

Fri Apr 27, 2012 5:37 pm

I think we found what is happening. The value of

sInstalldir = Session.Property("INSTALLDIR")

is empty. The application path is not being passed in the "INSTALLDIR" session property. How can we pass this to the .vbs script?

itmanager8815
Posts: 6
Joined: Tue Apr 10, 2012 7:23 pm

Re: Support for vbs scripts

Fri Apr 27, 2012 7:06 pm

I changed the .vbs script as follows:

sInstalldir = Session.Property("APPDIR")

and also added an Action Data with the value [APPDIR] to the custom action but it still does not work. The value of sInstallDir is still empty. Any assistance would be appreciated.

Daniel
Posts: 8237
Joined: Mon Apr 02, 2012 1:11 pm
Contact:  Website

Re: Support for vbs scripts

Mon Apr 30, 2012 10:58 am

Hi,

Please keep in mind that deferred type of custom actions do not have access to installer properties. So, you should run your VBScript file using an immediate custom action in order to access "APPDIR" property value. Also, your custom action should be scheduled in the sequence tree after "Install Execution Stage" -> "Paths resolution" -> "CostFinalize" standard action.

Let us know if this helps, otherwise please give us more details about your scenario.

Regards,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Building Installers”