I'm sure this has been done but I am unable to find it. I need to quit an install if Excel is running. I am using a custom action to determin if excel is running I update a property but am unsure how to stop the install.
0 Comments   [ + ] Show Comments

Comments

Please log in to comment

Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.

Answers

0
Can your custom action be run as an immediate action and then use a launch condition to notify the user that excel needs to be closed before attempting the installation?
Answered 10/30/2007 by: gmorgan618
Blue Belt

Please log in to comment
0
this is the custom action i wrote in vbscript to check if excel is running.

Dim strComputer, objWMIService, colProcesses, objProcess, running, WshNetwork, objArgs, app
app ="EXCEL.EXE"
strComputer="."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colProcessList = objWMIService.ExecQuery _
("SELECT * FROM Win32_Process WHERE Name = '" & app & "'")
For Each objProcess in colProcessList
session.Property("EXCELRUNNING") = 1
MsgBox (session.Property("EXCELRUNNING"))
Next

it sets the property correctly I am just not sure how to end the install after checking the property.

yes it run in execute immediate.
Answered 10/30/2007 by: SeaWall
Senior Yellow Belt

Please log in to comment
0
You need a Type 19 Custom Action. Check out Custom Action types in MSI.CHM for details.
Answered 10/31/2007 by: VBScab
Red Belt

Please log in to comment
0
You would make the VBScript into a function that you would then call from a custom action. You would also ensure that the custom action is set to check exit codes. An example of the script is below, this will terminate the MSI installation.

Function ExcelRunning()
Dim strComputer, objWMIService, colProcesses, objProcess, running, WshNetwork, objArgs, app, x
x = 0
app ="EXCEL.EXE"
strComputer="."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colProcessList = objWMIService.ExecQuery _
("SELECT * FROM Win32_Process WHERE Name = '" & app & "'")
For Each objProcess in colProcessList
x = x + 1
Next
If x >= 1 Then
ExcelRunning = 1602
Else
ExcelRunning = 0
End If
End Function

You return a 0 to the function to continue the installation and a terminated install if you pass a 1602.

-Save the above vbscript to your desktop
-add a new custom vbscript stored in the binary table
-browse to the desktop vbscript
-In "Script Function" enter in ExcelRunning and ensure that return processing is "synchronus(check exit code)"

Hope that makes sense!
Regards,
P
Answered 10/31/2007 by: Inabus
Second Degree Green Belt

Please log in to comment
Answer this question or Comment on this question for clarity