I’m thinking of reinstalling Windows 7 (yes, I know 8 is out, but I don’t want it). New Year, new OS. God I know how to party.
When I install a new OS, I always install it onto a virtual machine first. To test it, and also because my install disc is one I customized a bit.
So, I cranked up Microsoft Virtual Machine 2007 and installed Windows 7. All was fine, except I couldn’t connect the virtual machine to the Internet. I tried setting the network adapter to NAT as Google advised, and nothing.
Then I found someone mentioning that there’s a feature on your network adapter to enable virtual sharing. So I fired up Networking Sharing Centre.
- Clicked on the active connection
- Clicked Properties
- And ticked “Virtual machine network services”.
Low and beyond, the wireless network adapter was now an option on the virtual machine and I was away.
For some websites that I run I fairly regularly need to resize some photos to a certain width. ImageMagick is a great application for command line image manipulation.
The syntax to convert a file to a specific width and the corresponding height (which is what I want to do) is:
convert InputName.jpg -resize 550x Outputname.jpg
What I’ve found useful is running command line scripts through vbscript:
Set wshShell = WScript.CreateObject(“WSCript.shell”)
wshShell.Run “cmd.exe /C convert InputName.jpg -resize 550x Outputname.jpg”, 0, True
I know you can do all sorts of clever things from the command line, but not quite as many as vbscript can. I find it really useful to be able to access all of the vbscript logic, and read and write text files and so on, while at the same time being able to issue commands to the command prompt.
I have a spreadsheet, with a list of days in it. I want to sort them by their order in the week (ie, Monday – Sunday), but Excel being Excel, it seems them as words and sorts them in alphabetical order.
I’ve had a bit of a play and found two functions I never really use, both of which can do this:
This is neat and concise, but just returns the array element number.
A bit longer, but allows you to return arbitrary values, not just the array position.
I’ve been obsessed with automating and scripting things for a while now. I know it’s weird, but I actually enjoy scripting. It’s precise, it’s quick it’s efficient.
I’ve been using vbscript a lot, since you can automate most core components of Windows, you can automate Microsoft Office and also, it’s very easy. It has a syntax that really makes sense to me. There aren’t lots of curly braces, which I’m not a big fan of.
However, today, by chance, I discovered that you can automate much of Photoshop too using Actions. It essentially works by creating a Macro. You click on Window => Actions and then you can record a new action. I wish I’d known this yesterday when I went through and recoloured 26 images. But oh well, you live and learn. So I’ll be less stupid next time, which is all I can hope for.
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.
I needed to list all the tables in a SQL Server instance today.
It turns out, it’s not that hard:
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”