This website uses cookies. By clicking Accept, you consent to the use of cookies. Click Here to learn more about how we use cookies.
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
- Revenera Community
- :
- InstallShield
- :
- InstallShield Forum
- :
- Re: Calling vbscript function using Custom Action Wizard
Subscribe
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
Jan 30, 2012
08:00 AM
Calling vbscript function using Custom Action Wizard
Hi
I have a script which detects if outlook is running and offers to call it. It is within a function so I can return a value however it does not seem to run if added the project calling the particular function.
If I remove the function from the script it does bring the message box up.
The script from the script tab:
Function CheckOutlookOpen()
Set objProcs=GetObject("winmgmts:").ExecQuery("select * from Win32_Process where Name='OUTLOOK.EXE'")
Set WSshell = createobject("wscript.shell")
If objProcs.Count > 0 Then
intAnswer = MsgBox("All Outlook windows must be closed" & vbcr & "Click OK to close Outlook or click Cancel to exit the installation",17,"Outlook is running")
If intAnswer = vbOK Then
set olapp = CreateObject("Outlook.Application")
wsshell.appactivate "Outlook"
olapp.quit
CheckOutlookOpen = 1
ElseIf intAnswer = vbCancel Then
CheckOutlookOpen = 2
Else
CheckOutlookOpen = 2
End If
End If
End Function
If I add a call to the function at the end of the script and run it from the command prompt it does work.
Any help would be greatly appreciated.
Thanks
Amardeep
I have a script which detects if outlook is running and offers to call it. It is within a function so I can return a value however it does not seem to run if added the project calling the particular function.
If I remove the function from the script it does bring the message box up.
The script from the script tab:
Function CheckOutlookOpen()
Set objProcs=GetObject("winmgmts:").ExecQuery("select * from Win32_Process where Name='OUTLOOK.EXE'")
Set WSshell = createobject("wscript.shell")
If objProcs.Count > 0 Then
intAnswer = MsgBox("All Outlook windows must be closed" & vbcr & "Click OK to close Outlook or click Cancel to exit the installation",17,"Outlook is running")
If intAnswer = vbOK Then
set olapp = CreateObject("Outlook.Application")
wsshell.appactivate "Outlook"
olapp.quit
CheckOutlookOpen = 1
ElseIf intAnswer = vbCancel Then
CheckOutlookOpen = 2
Else
CheckOutlookOpen = 2
End If
End If
End Function
If I add a call to the function at the end of the script and run it from the command prompt it does work.
Any help would be greatly appreciated.
Thanks
Amardeep
(1) Reply