Friday, May 15, 2009

Scripting fun : Annoy your co-workers

I am a big fan of scripting (or any kind of automation for that matter. No matter what the task, there is almost always a reason to create a script and automate at least a piece of what you are trying to accomplish.

I will be honest, I am not script savvy enough to write complicated scripts. Thats what google.com is for.

I do have a script I would like to share. I can not take credit for writing it, I found if many years ago and just recently cracked it out to annoy a friend at work.

Great for April Fools!

vbscript to open a computer CD drive...


Const CDROM = 4
For Each d in CreateObject("Scripting.FileSystemObject").Drives
If d.DriveType = CDROM Then
Eject d.DriveLetter & ":\"
End If

Next
Sub Eject(CDROM)

Dim ssfDrives
ssfDrives = 17
CreateObject("Shell.Application")_
.Namespace(ssfDrives).ParseName(CDROM).InvokeVerb("E&ject")
End Sub