Answer» ok it suppose to make your CD Rom open up its a .vbs script but its not working i keep getting a ERROR do you guys see anything wrong
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
not very good at .vbs just wondering if you guys know whats wrong with thisThe DO has no corresponding LOOP statement and why are you duplicating the FOR statements?
Suggestion: remove the DO - not needed; the second FOR is redundant, what were you expecting to happen?
Before you ask, there is no method to close the CD drawer. Microsoft was probably worried about little fingers get caught.
Hope this helps. ok i got the vbs code to work by just useing thus code
Dim WMP: Set WMP = CreateObject("WMPlayer.ocx") Dim colCDROMS: Set colCDROMS = WMP.CDROMCollection If colCDROMS.Count > -1 Then For i = 0 to colCDROMS.Count - 1 colCDROMS.Item(i).Eject Next End If
ok now i have 2 things i need ONE is it possible to add a line so it will run this script and open every computer in a network cd roms.
and is there a way to make a timer so once u run the program it will be lik a countdown which the person cant see but once times out the script runs thanks
Sorry for the delay. Been busy with other projects. Generally, scripts run on the local machine, however if you have a network connection to a shared device on the network, your script, as written will open CD drawer's on remote machines.
The WScript.Sleep command will pause a script. Time is in milliseconds so as you wrote in you original post, WScript.Sleep 5000 will pause a script for 5 seconds.
Hope this helps. thanks for the reply
ok the sleep command i got it
ok now to the network connection to a shared device on the network, your script, as written will open CD drawer's on remote machines. so if we all sahre a device then the script will just run on all computers. what does the device have to be we all are connected to the same printerWhy would someone want a BAT file to open other pc cd/dvdrom drives.?Why would someone want a bat file to open other pc cd/dvdrom drives.?or are you thinking this prank:
http://www.jokingaround.com/Downloads.aspxim in a club at my school and it its like student prevention club we are like security at football games and stuff lik that i do to get community service hours when they ask in desperation to stop someone loading a disk into the cdrom to inflick cahoas. our skool dosent have very many people who can turn on a computer yet alone stop someone from useing it so i decided ill make a program that will open every cd rom in the skool i told the teachers (i was acually trying to be funny) y dont we just open every cd rom in the skool to stop this person.(i was laughing under my breath at this point) until my teacher looks at me and says thats a good idea. so i decide to make it i dont really no how its gonna stop the person but hey i get into the computer when ever i wantA slightly different script will enumerate the network printers:
Code: [Select] Set WshNetwork = WScript.CreateObject("WScript.Network") Set oPrinters = WshNetwork.EnumPrinterConnections WScript.Echo "Network printer mappings:" For i = 0 to oPrinters.Count - 1 Step 2 WScript.Echo "Port " & oPrinters.Item(i) & " = " & oPrinters.Item(i+1) Next
For more details on Windows Scripts check out the Hey! Scripting Guys and Office Space archives.
Hope this helps.
|