Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

Simple but useful - Eject/Retract CD tray script


  • Please log in to reply
9 replies to this topic
Diamond
  • Members
  • 198 posts
  • Last active: Dec 02 2015 11:18 AM
  • Joined: 31 Mar 2006
I got a bit of help from PhiLho and JSLover with the variable syntax, but I like this one better than the example in the help file. If you open/close the tray manually you might have to activate the hotkey twice to toggle it to the opposite state. I think that's about the only minor bug it has and I think most eject utilities have the same problem since there's apparently no good way to determine the current state of the tray. Well anyway here it is if anyone cares.

;Open/Close CD Tray
^+z::
DTray := !DTray
DriveGet, DStatus, StatusCD, D:
If DStatus In stopped,seeking,paused,playing
DTray = 1
DStatus =
If DTray = 1
{
Drive, Eject, D:
SetTimer, AutoCloseDTray, 15000
Return
}
If DTray = 0
{
SetTimer, AutoCloseDTray, Off
Drive, Eject, D:, 1
}
Return
;Close CD Tray After 15 Seconds
AutoCloseDTray:
SetTimer, AutoCloseDTray, Off
Drive, Eject, D:, 1
DTray =
Return

Of course, you can remove the timer function and use it on it's own if you don't like this option.

Diamond
  • Members
  • 198 posts
  • Last active: Dec 02 2015 11:18 AM
  • Joined: 31 Mar 2006
Small addition which should make detection more accurate.

slomz
  • Members
  • 601 posts
  • Last active: Mar 30 2008 12:54 AM
  • Joined: 03 Sep 2006
Nice script, but saying now. There have already been 50 of those made.

Diamond
  • Members
  • 198 posts
  • Last active: Dec 02 2015 11:18 AM
  • Joined: 31 Mar 2006
LOL 50? Really? Where? I've seen 1 or 2 around the forums, but 50? Come on now! Besides, it's all a matter of preference. I like the way mine works. I'm sure others prefer their own methods. Just sharing it just in case someone else likes it too. And although I'm sure that quite a few people have a script similar to this, most of them probably think it's too simple to bother sharing in which case it wouldn't count towards your supposed 50.

slomz
  • Members
  • 601 posts
  • Last active: Mar 30 2008 12:54 AM
  • Joined: 03 Sep 2006
lol, it is called exagarration buddy, I think you know what I means. There are many many many of them. Not all of them are under cd tray eject. Trust me.

Diamond
  • Members
  • 198 posts
  • Last active: Dec 02 2015 11:18 AM
  • Joined: 31 Mar 2006
I think I know what exaggeration means. However, in this particular case if you can't come up with a number that even comes anywhere near 50, then it was a pointless observation. And I think you'd have a hard time coming up with half that many whether they're filed under "cd tray eject" or not, which would make even "many many many" a ridiculous exaggeration. LOL don't think that I'm offended. It's just that I like debating fine points and when someone makes an outrageous statement that can't be supported, I feel the need to reply.

slomz
  • Members
  • 601 posts
  • Last active: Mar 30 2008 12:54 AM
  • Joined: 03 Sep 2006
Outstanding input.

Diamond
  • Members
  • 198 posts
  • Last active: Dec 02 2015 11:18 AM
  • Joined: 31 Mar 2006
No, exaggerated output!
:D
:)
:lol:
:p
:wink:
:twisted:

Neyon as guest
  • Guests
  • Last active:
  • Joined: --
Slomz just means there are already too many of them. And he's right. :twisted:

Diamond
  • Members
  • 198 posts
  • Last active: Dec 02 2015 11:18 AM
  • Joined: 31 Mar 2006
I don't think that further explanation of his meaning was required. I understood his point perfectly. I just don't happen to agree with it. Like I said before, where? A few maybe, but too many would imply a significant number which I've just never seen and I did search the forums pretty thoroughly before I wrote the script. And in the end what it really comes down to is that you're not required to use it.
:)