Frank Bastiaens
Posts: 17
Joined: Thu Apr 02, 2015 9:44 am

Execute Script Code Issue

Hello,

Small question, we're creating an MST for Google Chrome Enterprise and added (In custom Actions) an ExecuteScriptCode action.
With:

Code: Select all

Option Explicit

Dim oFSO,svc,cproc,sQuery,iniproc
Set oFSO = CreateObject("Scripting.FileSystemObject")

Const PROCESSNAME = "setup.exe"

Set svc = GetObject("winmgmts:root\cimv2")
sQuery = "select * from win32_process where name='" & PROCESSNAME & "'"

Set cproc = svc.execquery(sQuery)
iniproc = cproc.Count

If iniproc = 0 Then
    DeleteFile("C:\Users\Public\Desktop\Google Chrome.lnk")
    Set cproc = Nothing
    Set svc = Nothing
    wscript.Quit (1)
End If

Do While iniproc => 1
    wscript.sleep 5000
    Set svc = GetObject("winmgmts:root\cimv2")
    sQuery = "select * from win32_process where name='" & PROCESSNAME & "'"
    Set cproc = svc.execquery(sQuery)
    iniproc = cproc.Count
Loop

Set cproc = Nothing
Set svc = Nothing

Function DeleteFile(File)
	If oFSO.FileExists(File) then
		oFSO.DeleteFile(File)
	End if
End Function
This is placed after "Finish Execution", but it won't work, if it is tested manually it works fine.
Any tips or tricks?

Cheers, Frank
Catalin
Posts: 6585
Joined: Wed Jun 13, 2018 7:49 am

Re: Execute Script Code Issue

Hello Frank,

I am not sure I understand your scenario. Can you please give me some more details about what exactly is not working? Do you receive any error message?

Regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
Frank Bastiaens
Posts: 17
Joined: Thu Apr 02, 2015 9:44 am

Re: Execute Script Code Issue

Hello Catalin,

Simple, we do not want a google shortcut on the desktop after the installation, Chrome Enterprise is an wrapper around the Chrome Browser.

Cheers, Frank
Catalin
Posts: 6585
Joined: Wed Jun 13, 2018 7:49 am

Re: Execute Script Code Issue

Hello Frank,

I meant what exactly is not working with the custom action.

Do you receive any error messages? Or it simply does not execute?

Regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”