Introduction: Make an Annoying Program That Opens and Closes All Your Cd Drives

this is my first Instructable so please tell me how I can improve.

this instructable tells you how to make an annoying program that opens and closes all your cd drives.

you will need:
a computer running windows

Step 1: Open Notepad

first, open notepad
there are 2 ways I know of to do this
way 1:click the start button, go to programs or all programs, go to accessories click on notepad
way 2:hold down the windows key then press R then release the windows key, a box will pop up, in that box type notepad

Step 2: Type the Script

the notepad window should now be open
copy and paste the text below into notepad

do
Dim ts
Dim strDriveLetter
Dim intDriveLetter
Dim fs 'As Scripting.FileSystemObject
Const CDROM = 4
On Error Resume Next
Set fs = CreateObject("Scripting.FileSystemObject")
strDriveLetter = ""
For intDriveLetter = Asc("A") To Asc("Z")
Err.Clear
If fs.GetDrive(Chr(intDriveLetter)).DriveType = CDROM Then
If Err.Number = 0 Then
strDriveLetter = Chr(intDriveLetter)
Exit For
End If
End If
Next
Set oWMP = CreateObject("WMPlayer.OCX.7" )
Set colCDROMs = oWMP.cdromCollection
For d = 0 to colCDROMs.Count - 1
colCDROMs.Item(d).Eject
Next 'null

For d = 0 to colCDROMs.Count - 1
colCDROMs.Item(d).Eject
Next 'null

set owmp = nothing
set colCDROMs = nothing
loop

Step 3: Save and Test

save the file as cd.vbs on your desktop and double click it to run

Step 4: Make It Stop

press ctrl+alt+delete
open task manager
click processes
click wscript.exe
press end process

Comments

author
aidanjarosgrilli (author)2011-06-09

at a libray you run this program on ALL the computers and then leave.

author

I'v done something very similar at my library. I use other peoples codes to log into their system all of the time so one day i decided to do something stupid. The CD drives would pop open cause that's all that they could do, and then you couldn't close it cause it would just pop out again as soon as you are to close the CD drive :)

author
NathanF23 (author)StephenN22016-01-03

i did this using a different code which is Set oWMP = CreateObject("WMPlayer.OCX.7")

Set colCDROMs = oWMP.cdromCollection
do
if colCDROMs.Count >= 1 then
For i = 0 to colCDROMs.Count - 1
colCDROMs.Item(i).Eject
Next
For i = 0 to colCDROMs.Count - 1
colCDROMs.Item(i).Eject
Next
End If
wscript.sleep 5000
loop

how do i stop this one ?????

author
Joe Martin (author)2009-08-15

I've got a different version of this I made at college and it does it all silently and opens and closes it randomly, The only way you could stop it is to go into task manager, processes and then end the .vbs script. We also made one that flashes the caps, num and scroll lights and then another that presses caps lock randomly. It was worth the one week internet ban lol

author

nice, do you have the code for the caps lock flash?

author
mc_dude (author)2010-02-16

better yet put this on a cd along with a autorun.inf, and make a cd cover like (some awsome game for pc...) and when they put in the cd it spits it right back out =)

author
Lance Mt. (author)mc_dude2011-02-26

print trollface on the disk.

author
MegaM5 (author)2017-05-14

how can u open it and it stays open until u manually close it?

author
Pyrotelekinetic (author)2016-11-14

Not working on win 10...

author

worked for me. try it and check the code

author

did it, works, now gonna try do this at school or my sisters computer

author
Elliotd4 (author)2016-02-26

HOW DO I STOP THING HORRIBLE THING WHAT HAVE I DONE

author

go to task manager and stop wscript.exe

author
ZebA2 (author)2017-01-10

How do i make this run quicker? do i change the 4 value to 1?

author
The king of utopia (author)2015-02-06

Can you make it so that it will start when the computer starts when the computer starts? And is it possible to set it so it opens every 5 minutes not every 10 seconds?

author

Yeah, write it into the startup files of the computer.

author
kelliemurray (author)2016-08-24

I tried this on my laptop.....didn't work. =/

author
Keerthivasan11 (author)2016-06-10

after i test it

author
Keerthivasan11 (author)2016-06-10

will it stop

author
ColeM26 (author)2016-04-13

wow

author
KeeganR3 (author)2016-03-07

how do you edit this program to open every 5 hours or 6 hours?

author
CodyK5 (author)2016-01-19

I want to prank my wife and shes constantly got her laptop i don't know how to sneak it to her laptop without email or any means of flash drive ect.... i was wondering if there was a way i could spam her through a facebook message? or any thing like this.. ps thanks for the HERES YOUR COFFEE idea i tested it on mine and worked she loves coffee and this will be a wonderful wake up surprise!! XD

author
Flo0010 (author)2015-04-03

Hi, can someone please help me?
Always when I start the programm pop ups a window which says:
Syntaxerror Code: 800A03EA
The Error is on Line 8 the 9th Char

Thank You
Flo0010

author
Timothys2 (author)2015-01-26

Is there a way to change it from saying wscript in the task manager? I have a lot of simple programs like this one, and they all say wscript on them. I want to know if theres any way to change it at all.

author
ChrisN3 (author)2015-01-12

Can I add a message saying HERES YOUR FREE COFFEE everytime it opens???

author
jjbredesen (author)ChrisN32015-01-25

Yes you can, simply at this line at the beginning of the code before "do":

msgbox("HERES YOUR FREE COFFEE")

You can also make a file that only opens a message box like this:

do

msgbox("HERES YOUR FREE COFFEE")

loop

author
SamL1 (author)2014-11-14

I did this but when I go to task manager "wscript.exe" isn't there. HELP ME!!! I can't play any of my games :(.

P.S: I'm on Windows 8.

author
HenrikH1 (author)SamL12014-11-20

in windows 8 its called: microsoft windows based script host

author
narutou1 (author)2014-10-16

Not sure if it still works after the computer is restarted but if your doing this to a friend put it in the startup folder.

C:\Users\User\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup

~Von Hohenheim

author
VallexKoten (author)2014-10-13

How do I get it to open, close, and open the disk, instead of just opening it once?

author
d1ndian (author)2011-06-08

like netbot

author
liam6058 (author)DavidRobertson2009-08-18

your one doesent work on xp

author
Lance Mt. (author)liam60582009-09-16

lol, nice comeback but its written in vbs, of course its going to work, besides i gotta give meeze credit, hes PRO and he did it first.

author
liam6058 (author)Lance Mt.2011-02-17

his only opens the cd drives if you close them
mine opens and closes them

author
Lance Mt. (author)liam60582011-02-26

Well then its fine! Innovates and adds.

author
indestructibleguy (author)2010-02-23

how do you make it stop? I was stupid enough to try it out on my computer during programming.

author

look on last step

author
abran5 (author)2010-12-23

But how do you make it stop???

author
liam6058 (author)abran52011-02-17

look on last step

author
christop (author)2011-02-10

This is a lot like a script I wrote in Linux:

while :; do eject -T /dev/cdrom; done

Needless to say, it doesn't close the tray on laptop drives (but neither will the Windows script either).

And of course, this script can easily run in the background as any other non-interactive programs can in Linux. :)

author
abran5 (author)2010-12-23

i made it to do it for 20 seconds

author
abran5 (author)2010-12-23

IT WORKS!!!!!!!!!! THX!!!!!!!!!!!!!!!

author
Berkin (author)2009-12-17

It's making both by drives open and close one after one!

Thanks a million!

author
jamiec53 (author)2009-10-24
author
zack247 (author)2009-09-30

this is fun

author
matstermind (author)2009-08-22

how do i get it to repeat?

author
The Ideanator (author)2009-08-14

pretty funny, now make it do it randomly and have it run in the background, no one will know unless they know their stuff with windows

author

As far as I know, you can't run visual basic in the background. You should investigate python. The *.pyw extension makes it run without a terminal.

author
limpach (author)microman1712009-08-16

There is a function using pygame to open a CD-Drive but nothing to close it.

About This Instructable

292,435views

20favorites

License:

More by liam6058:make an annoying program that opens and closes all your cd drives
Add instructable to: