|
|
Our Hot Pick: Rising Antivirus 2006 - Certified by TUV & Checkmark! Get 10% discount by entering this coupon code: ONDISCOUNT10
For anyone who has installed visualizations, and then wanted to remove them (assuming 'Add/Remove Software' has failed), here's a sure way to get rid of them.
------Paste This Code Into UninstallVisualizations.vbs------ ' ___________________________________________________________________ ' ' VBScript File: UninstallVisualizations.vbs ' Author: Steven Petraglia ' ' Updates: . ' ' Built/Tested On: Windows XP ' ' Purpose: Display Menu Of Media Player Visualizations, ' Prompt User For Choice, Delete. ' This software may be used at the users own risk. ' ' Last Update: 2007-05-29 ' ___________________________________________________________________ '
Option Explicit
'-=-=-=-=-=-=-=-= 'GLOBAL CONSTANTS '-=-=-=-=-=-=-=-= Const WindowStyle = 5 Const WaitOnReturn = TRUE Const HKLM = &H80000002 Const HKCR = &H80000000
'-=-=-=-=-=-=-=-= 'GLOBAL VARIABLES '-=-=-=-=-=-=-=-= Dim intReturn Dim cnt, WshShell, i, j, k, s Dim Visuals(200), Selection, Title Dim DefaultValue
Dim DispCnt Dim FSO Dim TempName Dim full, data, msg, MediaEffectsPath Dim arrSubKeys, oReg, subkey, arrValueNames, arrValueTypes, Classid, VisualPath, ClsidPath Dim FoundClsid, DllPath, Dll Dim PopupText Dim SecondsToWait Dim ButType Dim intButton Dim rc, DllFolder, temp
'-=-=-=-=-=-=-=- ' Initialization '-=-=-=-=-=-=-=- DefaultValue = " " Title = "Delete Media Player Visualizations"
s = "" MediaEffectsPath = "Software\Microsoft\MediaPlayer\Objects\Effects"
'-=-=-=-=-=-=-=-=-=-=-=-=-= ' Create Shell Object '-=-=-=-=-=-=-=-=-=-=-=-=-= Set WshShell = WScript.CreateObject("WScript.Shell") if (err) then MsgBox "Can't Create WScript.Shell: " & vbCrLf & _ "Context ID:" & vbTAB & Err.HelpContext & vbCrLf & _ "Help File:" & vbTAB & Err.HelpFile & vbCrLf &_ "Error:" & vbTAB & Err.Description & vbCrLf & _ "Code: " & vbTAB & "0x" & hex(Err.Number) & vbCrLf & _ "Source:" & vbTAB & Err.Source , _ vbCritical, Title End If
'-=-=-=-=-=-=-=-=-=-=-=-=-= ' Create File System Object '-=-=-=-=-=-=-=-=-=-=-=-=-= Set fso = CreateObject("Scripting.FileSystemObject")
'-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- ' Get Registry Object '-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- Set oReg = GetObject _ ("winmgmts:{impersonationLevel=impersonate}!\\" _ & "." & "\root\default:StdRegProv")
'-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- ' Load Visualizations Into Array '-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- LoadVizMenu
'-=-=-=-=-=-=-=-=-=-=-=-=-= ' Any Visualizations Found? '-=-=-=-=-=-=-=-=-=-=-=-=-= If cnt = -1 Then MsgBox "No Visualizations Loaded Into Array", vbCritical, Title Else s = "" Selection = DefaultValue DispCnt = 0 i = 0
'-=-=-=-=-=-=-=-=-=-=-=-=-=-=- ' Loop While Selection = Blank '-=-=-=-=-=-=-=-=-=-=-=-=-=-=- While (Selection = DefaultValue and i <= cnt) rc = 0 '-=-=-=-=-=-=-=-=-=-=-=-=-=-= ' Add Number And Visualization To Menu '-=-=-=-=-=-=-=-=-=-=-=-=-=-= TempName = Visuals(i) DispCnt = DispCnt + 1 if s = "" Then s = i & vbTAB & TempName & vbCR else s = s & i & vbTAB & TempName & vbCR End If
'-=-=-=-=-=-=-=-=-=-=-=-=-=-= ' Is Menu Too Big For Screen? '-=-=-=-=-=-=-=-=-=-=-=-=-=-= if Dispcnt >= 25 or i = cnt Then if i = cnt Then s = s & vbCR & "Enter Number, - To Back Up or <ENTER> To QUIT" else s = s & vbCR & "Enter Number, - To Back Up or <ENTER> For More" End If
'-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= ' Display Menu. '-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Selection = InputBox(s, Title, DefaultValue) DispCnt = -1 s = ""
'-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= ' Edit Selection ' Possible Values: ' Len(Selection) = 0 - User Hit Cancel ' Dash - Go Back One Page ' Blank - Go Forward One Page '-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= If Selection = "-" Then Selection = DefaultValue if i >= 51 Then i = i - 51 else i = -1 End If Else If Len(Selection) = 0 Then ' User Hit Cancel Else If Selection = " " Then ' Next Page Else If not IsNumeric(Selection) Then MsgBox "You Must Enter A Number", vbCritical, Title
Selection = Defaultvalue if i >= 26 Then i = i - 26 else i = -1 End If Else If cInt(Selection) > cnt or cInt(Selection) < 0 Then MsgBox "Selection(" & Selection & ") Not Found", _ vbCritical, Title Selection = Defaultvalue If i >= 26 Then i = i - 26 Else i = -1 End If
Else '-=-=-=-=-=-=-=-=-=-=-=-=-=-= ' User Selected Visualization '-=-=-=-=-=-=-=-=-=-=-=-=-=-= FoundClsid = 0 Dll = "" DllPath = "" DllFolder = "" ClsidPath = "" Classid = ""
'-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= ' In Registry Goto ' HKLM\Software\Microsoft\MediaPlayer\Objects\Effects\(visualization-chosen)\Properties ' Get Classid Hex-String '-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= 'Wscript.echo "You Chose: <" & Selection & "> " & Visuals(Selection) VisualPath = MediaEffectsPath & "\" & Visuals(Selection)
Classid = WshShell.RegRead("HKLM\" & VisualPath & "\Properties\classid") if Classid = "" Then MsgBox "No Hex Classid String Found for " & Visuals(Selection) & "\Properties\classid",_ vbCritical, Title Else
'-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- ' In Registry Goto ' HKCR\CLSID ' Check Classid Hex-String Key '-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- ClsidPath = "CLSID\" & Classid DllPath = ClsidPath & "\InprocServer32"
If oReg.EnumKey(HKCR, ClsidPath, arrSubKeys) = 0 Then FoundClsid = 1 Dll = WshShell.RegRead("HKCR\" & DllPath & "\") else 'MsgBox "HKCR\CLSID\" & Classid & " Not Found", vbCritical, Title End If End if
'-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- ' Build Msg Box Of Items To Delete '-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- msg = Visuals(Selection) & " Classid=" & Classid & vbCR &_ "_______________________________________________________________" if not VisualPath = "" Then msg = msg & vbCR & "REGDEL HKLM\" & VisualPath End if
if not ClsidPath = "" Then msg = msg & vbCR & "REGDEL HKCR\" & ClsidPath End if
if not Dll = "" and FSO.FileExists(Dll) Then msg = msg & vbCR & "DELETE " & Dll End if
' Find Last '\' Before Filename j = InstrRev(Dll,"\") if j > 0 then
' Get Folder Name DllFolder = Left(Dll,j)
' Make Sure It Contains 'Visualizations' k = Instr(Ucase(DllFolder),Ucase("Visualizations\"))
' Is There Another Folder After 'Visualizations' ? if FSO.FolderExists(DllFolder) = True and k > 0 and K+15 <= len(DllFolder) Then ' Yes, Must Delete This Folder Too. ' Ex. C:\Program Files\Windows Media Player\Visualizations\Picture It! Viz2\ 'wscript.echo "k+15=" & K+15 & " len=" & len(DllFolder) & " mid=" & mid(DllFolder, K+15, len(DllFolder)) if right(DllFolder,1) = "\" Then DllFolder = Left(DllFolder, len(DllFolder)-1) End if
else DllFolder = "" end if end if
if not DllFolder = "" Then msg = msg & vbCR & "DELDIR " & DllFolder End if
'-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= 'Popup Window, Prompt To Delete '-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= SecondsToWait = 0 ButType = vbOKCancel intButton = WshShell.Popup(msg, SecondsToWait, "Confirm Delete", ButType)
'-=-=-=-=-=-=-=-= ' User Pressed OK '-=-=-=-=-=-=-=-= If (IntButton = vbOK) Then
'-=-=-=-=-=-=-=-= ' Delete DLL '-=-=-=-=-=-=-=-= if not Dll = "" and FSO.FileExists(Dll) Then On Error Resume Next FSO.DeleteFile(Dll)
if err.number <> 0 then rc = rc + 1 MsgBox "Delete " & Dll & " FAILED: " & vbCrLf & _ "Context ID:" & vbTAB & Err.HelpContext & vbCrLf & _ "Help File:" & vbTAB & Err.HelpFile & vbCrLf &_ "Error:" & vbTAB & Err.Description & vbCrLf & _ "Code: " & vbTAB & "0x" & hex(Err.Number) & vbCrLf & _ "Source:" & vbTAB & Err.Source , _ vbCritical, Title End if On Error Goto 0 End if
'-=-=-=-=-=-=-=-=- ' Delete DllFolder '-=-=-=-=-=-=-=-=- if not DllFolder = "" and FSO.FolderExists(DllFolder) Then On Error Resume Next FSO.DeleteFolder(DllFolder)
if err.number <> 0 then rc = rc + 1 MsgBox "DeleteFolder " & DllFolder & " FAILED: " & vbCrLf & _ "Context ID:" & vbTAB & Err.HelpContext & vbCrLf & _ "Help File:" & vbTAB & Err.HelpFile & vbCrLf &_ "Error:" & vbTAB & Err.Description & vbCrLf & _ "Code: " & vbTAB & "0x" & hex(Err.Number) & vbCrLf & _ "Source:" & vbTAB & Err.Source , _ vbCritical, Title End if On Error Goto 0 End if
'-=-=-=-=-=-=-=-=-=-=- ' Delete Registry Keys '-=-=-=-=-=-=-=-=-=-=- if not VisualPath = "" Then DeleteRegistryKey HKLM, VisualPath End If if not ClsidPath = "" Then DeleteRegistryKey HKCR, ClsidPath End If
wscript.echo "Ended RC=" & rc
'-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- ' ReLoad Visualizations Into Array '-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- LoadVizMenu
'-=-=-=-=-=-=-=-=-=-= ' User Pressed CANCEL '-=-=-=-=-=-=-=-=-=-= Else WScript.Echo "Request CANCELLED" End If '-=-=-=-=-=-=-=-=-=-=-=-=-=-= ' ReAdjust Menu POsition '-=-=-=-=-=-=-=-=-=-=-=-=-=-= Selection = Defaultvalue if i > 24 Then i = i - 25 Else i = -1 End If
End If End If ' If Else not IsNumeric(Selection) End If ' If Else Selection = BLANK End If ' If Else Len(Selection) = 0 End If ' If Else Selection = Dash End If
'-=-=-=-=-=-=-=-=-=-=-=-=- ' Increment For Next Entry '-=-=-=-=-=-=-=-=-=-=-=-=- i = i + 1
Wend
End If ' If Else Cnt = -1
'-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= END OF MAINLINE -=-=-=-=-=-=-=-=-=-=-
'-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= DELETEREGISTRYKEY -=-=-=-=-=-=-=-=-=-=-
' ___________________________________________________________________ ' ' Sub: DeleteRegistryKey ' Description: Recursively delete a Registry Key, searching for the ' lowest level first. ' ___________________________________________________________________
Sub DeleteRegistryKey(ByVal sHive, ByVal sKey) Dim aSubKeys, sSubKey, iRC
On Error Resume Next
'-=-=-=-=-=-=-= ' Enumerate Key '-=-=-=-=-=-=-= iRC = oReg.EnumKey(sHive, sKey, aSubKeys) If iRC = 0 And IsArray(aSubKeys) Then
'-=-=-=-=-=-=-=-=-= ' Loop Thru Subkeys '-=-=-=-=-=-=-=-=-= For Each sSubKey In aSubKeys If Err.Number <> 0 Then Err.Clear Exit Sub End If
'-=-=-=-=-=-=-=-=-=-=-=-=-=-= ' Recursively Search For Last '-=-=-=-=-=-=-=-=-=-=-=-=-=-= DeleteRegistryKey sHive, sKey & "\" & sSubKey Next End If
'-=-=-=-=-=-=-=-=-=-=-=-=-= ' We Hit Bottom, Delete Key '-=-=-=-=-=-=-=-=-=-=-=-=-= oReg.DeleteKey sHive, sKey if err.number <> 0 then rc = rc + 1 MsgBox "DeleteKey " & sKey & " FAILED: " & vbCrLf & _ "Context ID:" & vbTAB & Err.HelpContext & vbCrLf & _ "Help File:" & vbTAB & Err.HelpFile & vbCrLf &_ "Error:" & vbTAB & Err.Description & vbCrLf & _ "Code: " & vbTAB & "0x" & hex(Err.Number) & vbCrLf & _ "Source:" & vbTAB & Err.Source , _ vbCritical, Title End if On Error Goto 0
End Sub
'-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= END OF DELETEREGISTRYKEY -=-=-=-=-=-=-=-=-=-=-
'-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= LOADVIZMENU -=-=-=-=-=-=-=-=-=-=- ' ___________________________________________________________________ ' ' Sub: LoadVizMenu ' Description: Goto the Registry Key for Visualizations, enumerate ' it and place keys in array. ' ___________________________________________________________________
Sub LoadVizMenu
'-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- ' In Registry Goto ' HKLM\Software\Microsoft\MediaPlayer\Objects\Effects ' Enumerate Visualization Keys. ' Place In Array. '-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- cnt = -1 If oReg.EnumKey(HKLM, MediaEffectsPath, arrSubKeys) = 0 Then For Each subkey In arrSubKeys 'Wscript.Echo subkey cnt = cnt + 1 Visuals(cnt) = subkey Next else MsgBox "No Visualizations Found in HKLM\" & MediaEffectsPath, vbCritical, Title End If
End Sub ------Paste This Code Into UninstallVisualizations.vbs------
**NOTE** Before executing, it's always a good idea to backup Folder: C:\Program Files\Windows Media Player\Visualizations Registry Keys: HKLM\Software\Microsoft\MediaPlayer\Objects\Effects HKCR
**ALSO** You may have to allow your AntiVirus Software to authorize the script.
To Execute: double-click: UninstallVisualizations.vbs -- Steven R. Petraglia
|
|
|