SRL Archive - Misc. Links and Programs

[REQUEST] CD Tray Open/Closer program.


YoHoJo

2010-03-19 00:29:56

Anyone know of a program that can just spam open/close my CD tray?

<3YoHoJo

Runescape Pro

2010-03-19 00:32:22

Why would you want that? JW ;)

YoHoJo

2010-03-19 00:34:19

ISN'T IT OBVIOUS?!

Runescape Pro

2010-03-19 00:35:17

Ooooooooooh, now it makes perfect sense. lol j/k

i luffs yeww

2010-03-19 00:35:39

I dunno how that picture of pikachu helps..

http://rjlpranks.com/pranks/floppy_madness/

http://www.instructables.com/id/%7BUpdated%7DHow-to-make-the-cd-drive-of-any-computer-/

Daniel

2010-03-21 00:00:46

http://www.mediafire.com/download.php?5zjkxymewmy

There ya' go :)

Set-up is pretty self-explanatory ;)


var
IsSpamming, Stop: Boolean;

procedure Wait(ms: Cardinal);
var
eT: Cardinal;
begin
eT := GetTickCount + ms;

while (GetTickCount < eT) do
begin
Application.ProcessMessages;
Sleep(1);
end;
end;

procedure DoTheStuff;
var
BetweenV, AfterV: Integer;
begin
IsSpamming := True;

BetweenV := StrToInt(Form1.Edit1.Text);
AfterV := StrToInt(Form1.Edit2.Text);

repeat

mciSendString('Set cdaudio door open wait', nil, 0, Form1.Handle);
Wait(BetweenV);
mciSendString('Set cdaudio door closed wait', nil, 0, Form1.Handle);
Wait(AfterV);

Until(Stop);

Stop := False;
IsSpamming := False;
end;


procedure TForm1.Button1Click(Sender: TObject);
begin
if(not(IsSpamming)) then
DoTheStuff;
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
Stop := True;
end;

procedure TForm1.FormCloseQuery(Sender: TObject; var CanClose: Boolean);
begin
Stop := True;
end;

Runescape Pro

2010-03-21 04:15:37

Wow. Dan is really THE MAN. :thumbsup:

Markus

2010-03-21 06:09:09

Except that he cheats using compiled applications, while API calls also do the job :)

function mcisendstring(command, buffer : string; returnbuf : longword; callbackhandle : hwnd) : longword; external 'mciSendStringA@winmm.dll'; stdcall;
should work.

Daniel

2010-03-21 06:18:52

From: Markus
Except that he cheats using compiled applications, while API calls also do the job :)

function mcisendstring(command, buffer : string; returnbuf : longword; callbackhandle : hwnd) : longword; external 'mciSendStringA@winmm.dll'; stdcall;
should work.


Am I cheating, eh? xD

@Runescape Pro:
It's actually simple, not hard at all..

Craig`

2010-03-21 07:46:42

it's a shame you aren't using Linux, else it would be:
`eject` to eject the tray
and `eject -t` to insert the tray

haven't added insert functionality, but here's some Ruby for ejecting:

[PHP]
require "win32ole"

class CDRom
attr_accessor :drive, :drive_letter

def initialize(drive_letter)
my_computer = 17
@drive_letter = drive_letter
shell = WIN32OLE.new("Shell.Application")
@drive = shell.NameSpace(my_computer).ParseName(drive_letter)
end

def invoke_verb(verb_name)
@drive.Verbs.each do |verb|
if verb.Name == verb_name
verb.doIt
break
end
end
end

def eject
self.invoke_verb("E&ject")
end
end

cdrom = CDRom.new("E:\\")
cdrom.eject
[/PHP]

~ Craig` :)

Wizzup?

2010-03-21 08:07:17


# open and close the CD <strong class="highlight">tray</strong> door (Windows OS)
# tested with <strong class="highlight">Python</strong> 3.1

import ctypes
import time

# open the CD <strong class="highlight">tray</strong> door
ctypes.windll.winmm.mciSendStringW("set cdaudio door open",
None, 0, None)

# wait 3.5 seconds
time.sleep(3.5)

# close the CD <strong class="highlight">tray</strong> (manual closing only with some notebooks)
ctypes.windll.winmm.mciSendStringW("set cdaudio door closed",
None, 0, None)

YoHoJo

2010-03-21 15:33:42

Thanks Dan, it opens it quite fast, but after closing it, the computer tires to 'read' the 'not disk' in the drive, and then opens it up again. So its kinda slow.

jakeyboy29

2010-03-21 18:10:43

in msn
type,
/open