/build/static/layout/Breadcrumb_cap_w.png

How to make this VBScript work without any pop up boxes

Hi,

This is a VBScript to remove all previous versions of Real Player.I need this VBScript to work without any pop up boxes or User interaction or even if the browser windows are open(This script stops the Uninstallation if the user has some browser windows open and displays a dialog box, I do not want that dialog box) What do I need to edit in this code to achieve it?

On Error Resume Next
Set sho = Wscript.CreateObject('Wscript.Shell')
Set fso = Wscript.CreateObject('Scripting.FileSystemObject')
strCurrentDir = Left(Wscript.ScriptFullName, (InstrRev(Wscript.ScriptFullName, '\') -1))
If fso.FileExists('C:\Program Files\Common Files\Real\Update_OB\r1puninst.exe') Then
sho.Run(Chr(34) & 'C:\Program Files\Common Files\Real\Update_OB\r1puninst.exe' & chr(34) & ' -all'),0,vbFalse
intret1 = fso.FolderExists('C:\Program Files\Real\Realplayer\Netscape6\')
Do While intret1 = -1
WScript.Sleep 10000
intret1 = fso.FolderExists('C:\Program Files\Real\Realplayer\Netscape6\')
If intret1 <> -1 then
For Each Process In GetObject('winmgmts:{impersonationLevel=impersonate}!//localhost').ExecQuery('select * from Win32_Process where Name='r1puninst.exe')
Process.Terminate
Next
Exit do
End If
Loop
End If
intret = sho.run('msiexec.exe /i ' & Chr(34) & strCurrentDir &_
'\RealPlayerEnterpriseFree1.12.msi' & Chr(34) &_
' /l*v c:\sysutils\rpent112.log /qb-! ALLUSERS=1',0,vbTrue)
WScript.Quit(intret)
-------------------------------------------------------------------------------------------------------------------
And where should i install it in the msi. I use Wise package studio.
Where should I sequence it so that it Uninstalls any older version of Real Player before installing the latest version from the msi?

0 Comments   [ + ] Show comments

Answers (8)

Posted by: anonymous_9363 16 years ago
Red Belt
0
ORIGINAL: TP24667
This script stops the Uninstallation if the user has some browser windows open and displays a dialog box
Does it?!? All I can see is a test for the existence of 'C:\Program Files\Real\Realplayer\Netscape6\'... I can only assume that what you posted isn't the whole script.

I'd recommend a different approach. Besides anything else, the script's execution is sub-optimal, having next to no error-trapping. Build a stub EXE in Wise which tests for previous RP version's product codes and, if found, calls MSIExec to uninstall them, as in:

MSIEXEC /X {ProductCode}

BTW, use the 'Code' button (marked '<%') for inserting code fragments, log files, etc. It honours indentation and such as well as using a scrolling textarea.
Posted by: TP24667 16 years ago
Senior Yellow Belt
0
Hi...Thanx for Replying..Yes that is the whole script and it Uninstalls any version of Real Player prefectly except that if any browser window is open it will throw a pop up box asking the user to close the Windows which is what I dont want.
There is no product code for Real Player free version which I am re-packaging using WISE.And all teh previous Real Players are legacy .exe.
I am also new to re-packaging. If you could let me know how to edit this vb code and also where to insert it in the msi script...User Interface, Execute Immediate or Execute deffered and where excatly in those.


Thanks.....
Posted by: anonymous_9363 16 years ago
Red Belt
0
I can only assume, then, that the uninstaller itself is testing for the browser processes, in which case there's nothing you can do to prevent it popping up its own windows/dialogs. You *could* however add that detection to the script (or a separate one):

Option Explicit

Dim strQueryStub
Dim strProcessList
Dim arrProcessList
Dim strProcessName
Dim intIndex

strProcessList = "netscape.exe, iexplore.exe, firefox.exe, opera.exe"

arrProcessList = Split(strProcessList, ",")

strQueryStub = "select * from Win32_Process where Name="

For intIndex = 0 To UBound(arrProcessList)
strProcessName = Trim(arrProcessList(intIndex))

strQuery = strQueryStub & "'" & strProcessName & "'"

For Each Process In GetObject("winmgmts:{impersonationLevel=impersonate}!//.").ExecQuery(strQuery)
Process.Terminate
Next
Next


Where to place the script(s)...hmmm...I'd plump for Execute Immediate. Make sure you add the condition 'If Not Installed' so that it only runs if the MSI isn't already installed.
Posted by: TP24667 16 years ago
Senior Yellow Belt
0
Hi..are you on yahoo, msn messenger or Google Talk where i can chat with you....
Posted by: TP24667 16 years ago
Senior Yellow Belt
0
Hi..could you tell me where exactly to place it in Execute Immediate..and should it be Synchronous,No Exit or some other option...

Also the script you provided I tried to Include that in my script but it did not help.....
Posted by: anonymous_9363 16 years ago
Red Belt
0
ORIGINAL: TP24667
Hi..could you tell me where exactly to place it in Execute Immediate
It seems you're going to persist with the script so somewhere before the built-in InstallFiles action, I guess...just after RemoveFiles seems appropriate.

ORIGINAL: TP24667
should it be Synchronous,No Exit or some other option...
Definitely 'Synchronous and, since your script is quite simplistic with no error-trapping, I'd use the 'Ignore Exit Code' flavour.
Posted by: anonymous_9363 16 years ago
Red Belt
0
ORIGINAL: TP24667
Hi..are you on yahoo, msn messenger or Google Talk where i can chat with you....
From experience, I'd say that for almost anyone working for corporate clients - and on a packaging site that's not an unreasonable conclusion to make about members - the answer to that question is effectively "No", as IM sites, other than internal ones, will be firewalled-out/blacklisted.
Posted by: TP24667 16 years ago
Senior Yellow Belt
0
Thanx for all the help....
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ