Monday, September 27, 2010

Sky+ remote codes

Our Sky+ remote went down this weekend, and whilst you can get basic functionality with the buttons on the front of the machine, it's a right pain and you can't really use Sky+ properly at all.

Luckily my dad had a spare new Sky+ HD remote, which I thought would work.

If you need to get a different type of remote to work with Sky, Sky+ or Sky HD. Here's how:

1 press the TV button
2 press and hold the Select and i buttons until the red light on the remote flashes twice
3 press the 1 button (0=Standard, 1=Sky+, 2=Sky HD)
4 press the Select button (the red light should flash twice, if it doesn't, your remote cannot control a Sky+ Digibox)
5 press the Sky button

There are also other 'reset' codes and TV codes, which are easily available on the web. But this was the one we needed to get our remote working with our Sky+.

Now for some soldering of the old remote...

Thursday, September 16, 2010

Restoring a Dell factory image file (.wim) to a new hard disk

A bit of googling I found this excellent article on tjb-ts.blogspot which gave me the quick indication that this COULD be done and how to do it.

Basically, I extracted the factory.wim file from the recovery partition of a failing hard drive, and also got the imagex.exe and it's config files from the tools folder in the recovery partition and stuck them all on my external usb.

Then, using a vista disk, I booted into the recovery options after installing a new hard drive.

Going into command line, I issue the following commands to get the new hard disk ready, active and formatted:

select disk 0
create partition primary
assign letter=c:
format c: /q /y

once this was complete, I navigated to my USB drive (handy that vista boot disk repair has usb support - as does windows 7) and ran the imagex command to restore the factory.wim file:

Imagex /apply factory.wim 1 c:\

Once this was complete, and again, thanks to the tjb-ts blog, I needed to run the vista startup repair option, which sorted out the booting issue. If I didn't run this option, then vista wouldn't load.

All in all, a successful operation!

Friday, September 3, 2010

Searching in Windows for NOT those things!

I recently have began cataloguing and cleaning up my media library to enable the new media unit at home to more easily serve us the pics, music and video that I have amassed over the years...

After renaming many files with prefixes to allow for faster searching, and getting all the mp3 tags correct and orderly, I wanted to check through my directories for any files that were NOT meant to be in the respective folders. IE in my music directory, for any files that were NOT .mp3, and in my pictures, any files that were NOT .jpg, etc.

I found out you cant do this with Windows search. DOH!

I found out (on Eileen's Lounge - thanks Hans!) that a command line will do this. Yay!
For instance:

dir "C:\Documents and Settings\\My Documents\My Music" /s | find /v /i ".mp3" | C:\result.txt

will pipe a LOT of info into a text file, detailing any files not of the type .mp3 in the music directory. There is a lot of verbatim with this method to sift through though.

I think Google desktop search could probably do this with less verbatim, but I don't have this app (no major use for it) and didn't want to install it. I would rather write a nice little script...

I called it the NOT search. I have posted it for download with an .exe version on 'Eileen's Lounge (formerly Woodies Lounge)' here.

It basically prompts you for the directory to search on, then for the file types to exclude, ie NOT search on, and then offers folder recursion, ie search through all subfolders. Once complete a nice little report is presented to you in Notepad, detailing any found files and their paths. I found this very helpful indeed and was able to clean up and move any files to where they should be.

The code is below:

'// pmatz's file extension NOT search - sept 01 2010. v 1.1
'// script to search for all files with extension's NOT specified

Public strList


Sub main
strList = ""
Dim strFileExtensions()
strPath = InputBox ("Enter path to search on." & vbCr & _
"(For root drives please use driveletter" & vbCr & _
"followed by :\ )" ,"pmatz's file extension NOT search")
If IsEmpty(strPath) Then
Exit Sub
End If
strGetFileExts = InputBox ("Enter filetype/s NOT to search for." & vbCr & _
"(seperate file extensions with commas and leave no spaces" & vbcr & _
"e.g. .mp3,.jpg,.gif,.tar,.iso)","pmatz's file extension NOT search")
bRecurse = (MsgBox("Recurse through all subfolders?",vbYesNo) = vbyes)
strTypes = strGetFileExts
iExtensions= 0
ReDim Preserve strFileExtensions(iExtensions)
iComma = InStr(1,strGetFileExts,",")
If iComma > 0 Then
strFileExtensions(iExtensions) = Left(strGetFileExts,iComma-1)
strGetFileExts = Right(strGetFileExts,Len(strGetFileExts)-iComma)
End If
Loop Until iComma = 0
strFileExtensions(iExtensions) = strGetFileExts
search strPath, strFileExtensions, bRecurse
createOutput strPath,strTypes
End Sub

Sub search(searchFolder,excludeTypes,recurse)
On Error Resume Next 'this stops crash for issues with no access etc.
bFound = False
Set fso = CreateObject("Scripting.FileSystemObject")
If Not fso.FolderExists(searchfolder) Then
Exit Sub
End If
Set fFolder = fso.GetFolder(searchFolder)
Set fSubfolders = fFolder.SubFolders
Set fFiles = fFolder.Files
For Each fFile in fFiles
For iExtension = 0 To UBound(excludeTypes)
For iStop = Len(fFile.Name)To 0 Step -1
If Mid(fFile.Name,iStop,1) = "." Then
iStop = Len(fFile.Name)-iStop + 1
Exit For
End If
If UCase(Right(fFile.Name,iStop)) = UCase(excludeTypes(iExtension)) Then
bFound = True
End If
If Not bFound Then
strList = strList & vbNewLine & fFile.Path
bFound = False
End If
If recurse Then
For Each fSubfolder In fSubfolders
search fSubfolder.Path,excludeTypes,True
End If
Set FSO = Nothing
Set fFolder = Nothing
Set fSubfolders = Nothing
Set fFiles = Nothing
End Sub

Sub createOutput(strPath,StrTypes)
Set oShell = CreateObject("WScript.Shell")
strOut = oShell.SpecialFolders("Desktop")
Set fso = CreateObject("Scripting.FileSystemObject")
strOut = strOut & "\pmatzFileExtensionNOTsearch_" & getStamp & ".txt"
Set f = fso.CreateTextFile(strOut)
f.WriteLine "pmatzFileExtensionNOTsearch performed on " & Now()
f.WriteLine "Searched through " & strPath & ", excluding types " & strTypes
f.WriteLine "__________________________________________________"
f.Write strList
oShell.Run("%systemroot%\notepad.exe " & strOut)
Set oShell=Nothing
Set fso = Nothing
Set f = Nothing
End Sub

Function getStamp
strStamp = FormatDateTime(Now(),2)
strStamp = Replace(strStamp,"/","-")
strStamp = strStamp & "_" & FormatDateTime(Now(),4)
strStamp = Replace(strStamp,":","-")
getStamp = strStamp
End function

Sub closeMessage1
MsgBox "Need to enter a legitimate path!",vbinformation,"pmatz's file extension NOT search"
End Sub