They say you learn something new every day.

Archive for October, 2012

New lines in Notepad2 (31/10/2012)

I’ve always been a big fan on Notepad2. It’s far better than the standard Notepad, has syntax highlighting, more features and is very fast.

It’s also just a single executable file and tiny. There are plenty of notepad replacements, but this one is so simple, that it’s my go to replacement.

One thing I’ve often wanted to do though, is add or remove line breaks. I’ve never managed to do this before, but today I realised it’s actually very simple, I was just being stupid.

I came across a blog that reminded me how to do it. There are a couple of different new line characters: \r or \n, but if you want to add them in, you just need to remember to tick “Transform backlashes”.

Brilliant. Another minor inconvenience solved.

  

Listing Tables (15/10/2012)

I needed to list all the tables in a SQL Server instance today.

It turns out, it’s not that hard:

EXEC [sp_tables]

Check if a window is open (09/10/2012)

This script runs in the background and stays there until “My Shared Folder” is opened, and then it pops up and says it’s opened. “My Shared Folder” doesn’t have to be  the active window, it just needs to be open.

Set oShell = CreateObject(“WScript.Shell”)

DO UNTIL Done = “Yes”
  If oShell.AppActivate(“My Shared Folder”) Then
    Done = “Yes”
    Wscript.echo “My Shared Folder is Open”
    wscript.sleep 300
  End If
LOOP