Just a short, simple blog for Bob to share his thoughts.
11 April 2014 • by Bob • Scripting, Windows
So here's the deal: I don't use anything from Apple. I have no iPod, no iPhone, no Mac, etc. I buy all of my MP3s through Xbox Music and Amazon. :-] Because of this, I have had no real need to install iTunes or QuickTime in years.
But unfortunately it seemed that I had to install either iTunes or QuickTime at one time or other, mainly because some of my digital cameras recorded video in QuickTime *.MOV format. But over the years I learned to detest both iTunes and QuickTime because of the undesirable ways in which they modified my system; both iTunes and QuickTime would remap all of media settings to open in their @#$% player, which I didn't really want in the first place.
Now that Windows supports the *.MOV format natively, and I can easily convert *.MOV files into something infinitely more useful and universal like *.MP4 format, I really never see the need for installing either iTunes or QuickTime.
However, just the other day I installed a new video editor (which shall remain nameless) and it quietly installed QuickTime on my system. I presume that this was to make it easier to import files in *.MOV format into the video editor, but I was pretty upset when I discovered that QuickTime had been installed. What's more, I was angry when I discovered that QuickTime had once again messed up all of my media settings.
In all of this misery is one saving grace: QuickTime has the decency to preserve your original settings. I am assuming that the backups are for when you uninstall QuickTime and attempt to reclaim your system from being hijacked by Apple, but just the same - that little nicety allowed me to fix my system with a little bit of scripting.
So without further introduction - first the script, and then the explanation:
Const HKEY_CLASSES_ROOT = &H80000000 Const strQuickTimeBAK = "QuickTime.bak" Set objRegistry = GetObject("winmgmts:" & _ "{impersonationLevel=impersonate}" & _ "!\\.\root\default:StdRegProv") objRegistry.EnumKey HKEY_CLASSES_ROOT, "", arrSubKeys For Each objSubkey in arrSubKeys If Len(objSubkey)>2 Then If Left(objSubkey,1)="." Then objRegistry.EnumValues HKEY_CLASSES_ROOT, _ objSubkey, arrEntryNames, arrValueTypes If IsArray(arrEntryNames) Then For i = 0 To UBound(arrEntryNames) If StrComp(arrEntryNames(i), strQuickTimeBAK, vbTextCompare)=0 Then intReturnValue = objRegistry.GetStringValue( _ HKEY_CLASSES_ROOT, objSubkey, strQuickTimeBAK, strEntryValue) If intReturnValue = 0 Then intReturnValue = objRegistry.SetStringValue( _ HKEY_CLASSES_ROOT, objSubkey, "", strEntryValue) End If End If Next End If End If End If Next
Here's what this script does: first the script enumerates all of the keys under HKEY_CLASSES_ROOT and looks for file extension mappings, then it looks for mappings which have been modified and backed up by QuickTime. When it locates file extensions which have been modified, it copies the value which was backed up into the default location where it belongs.
All-in-all, it's a pretty straight-forward script, but it sucks that I had to write it.