Jump to content
Sign in to follow this  
Nbanonimous

Help on CD tray open

Recommended Posts

hey guys

im total newb at this

but uh someone gave me this

$Cd = DriveGetDrive ( "CDROM" )

If @Error Then

MsgBox(0, "Critical Failure", "An important piece of equipment is missing" & @CRLF & _

"Code execution is aborted")

Exit

Else

If CDTray($Cd[1], "Open") Then

MsgBox(0,'CD Test', 'The tray should be open')

Else

MsgBox(0, 'Oooops!', "Houston....We have a problem")

EndIf

EndIf

How do i make a loop making the CD drive pop out 8 times after he pushes it back in 8 times

so everytime it goes back in, it pushes out, 8 times

Share this post


Link to post
Share on other sites

I'm very curious to know why you want to do this :)

I don't think it's possible to know to know if the tray is open or closed with the built-in functions. But, it is possible if it has a CD inside. Using DriveStatus() should return NOTREADY if it's open or it has no CD inside and READY when it has media in it.

So, this is my try:

Instert a CD first, wait till it loads (light should stop blinking) and then run the script. It will open the CD tray and pause. When you close it again and the CD loads, it will open it again. It should do this 4 times. Set the counter to whatever number you want.

I'm not sure if it will be good for you, but this is all I can do. Perhaps a more experienced user can come up with something better ^_^

$Cd = DriveGetDrive("CDROM")
If @error Then
    MsgBox(0, "Critical Failure", "An important piece of equipment is missing" & @CRLF & _
            "Code execution is aborted")
    Exit
Else
    $i=1
    Do
        Sleep(700)
        $status=DriveStatus($Cd[1])
        If $status="READY" Then
            $i+=1
            If CDTray($Cd[1], "Open") Then
                MsgBox(0, 'CD Test', 'The tray should be open')
            Else
                MsgBox(0, 'Oooops!', "Houston....We have a problem")
            EndIf
        EndIf
    Until $i=4
EndIf

Share this post


Link to post
Share on other sites

CODE
; Open the CD tray on drive E: then D:

CDTray("E:", "open")

sleep(4000)

cdtray("E:", "close")

Sleep(4000)

CDTray("D:", "open")

Sleep(4000)

CDTray("D:", "close")

try that it opens the drives on mine waits so long then closes them if u want u can add something in there to check if cd in there if not then it can open if does then play but i havnt got that far


C.Wnew rules:1.dont use plz in a post or title use please instead2.always use help file as it is now muchly over rated3. dont think where not watching u4.please wait 24 hours after last post ot bump XD i use to make that mistake

Share this post


Link to post
Share on other sites

Dude, nobody is going to give you an answer if you don't make it clear for everyone. What exactly do you want to do?

Doing it the way Aceguy suggested will open the CD tray, wait 4 seconds, close it, wait 10 seconds, open it, wait 4 seconds and close it again. Change the g: to whatever letter your cd-drive has. And like weaponx said, There are better ways to eff with people than opening and closing the cd tray.

Share this post


Link to post
Share on other sites

Instead of cluttering the forums with nonsense, just punch your friend / enemy in the face, say MERRY X-MAS BEEYOTCH and call it a day. Better yet, punch yourself in the face.

EDIT AGAIN. Whos the Grinch now?

Edited by weaponx

Share this post


Link to post
Share on other sites

try this...

While 1
Sleep (800)
CDTray("D:", "open")
Sleep (100)
CDTray("E:", "open")
WEnd

that will continue to open it. when someone tried to close it it will open again before its closed. if you want it so theres no little icon at the bottom do this:

#NoTrayIcon

While 1
Sleep (800)
CDTray("D:", "open")
Sleep (100)
CDTray("E:", "open")
WEnd

this is kinda pointless if your using it to get on someones nerves though.

Share this post


Link to post
Share on other sites

ffs. You're putting so much effort into something that isn't even that funny. Just have it wait 30 seconds or something, you know he probably closed it by then. Or just have it close itself and open itself randomly, then he's gonna be confused.

It's not even that original of a way to mess with someone on a PC. It's about as original as taking a dump in the toilet tank so when someone flushes it comes out in the bowl.

Share this post


Link to post
Share on other sites

this is the dumbest prank prog ever...

@sumkid, It will not re open before it has closed... it will close>read>reopen... quite a delay

but why the CD tray.... there are so many better ways to piss somebody off

You're right. The first time I did this it was advertised as a free drink holder from Coca Cola.

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
Sign in to follow this  

×
×
  • Create New...