Welcome Guest.   Make a donation to an author on the site September 17, 2014, 12:30:50 AM  *

Please login or register.
Or did you miss your validation email?


Login with username and password (forgot your password?)
Why not become a lifetime supporting member of the site with a one-time donation of any amount? Your donation entitles you to a ton of additional benefits, including access to exclusive discounts and downloads, the ability to enter monthly free software drawings, and a single non-expiring license key for all of our programs.


You must sign up here before you can post and access some areas of the site. Registration is totally free and confidential.
 
The N.A.N.Y. Challenge 2011! Download 30+ custom programs!
   
   Forum Home   Thread Marks Chat! Downloads Search Login Register  
Pages: [1]   Go Down
  Reply  |  New Topic  |  Print  
Author Topic: Eject/CloseCD  (Read 10006 times)
CleverCat
Supporting Member
**
Posts: 1,126


Cat's Are Fun!

see users location on a map View Profile Give some DonationCredits to this forum member
« on: February 05, 2008, 03:10:17 AM »

Works great Thmbsup but...

Have changed script to reflect only one drive, but it still does 2 simultaneously?

 smiley
Logged

If you need help - JUST ASK!
lanux128
Global Moderator
*****
Posts: 6,089



see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #1 on: February 05, 2008, 08:58:30 PM »

post modified script here so that someone can have a look and suggest what's wrong. Wink
Logged

CleverCat
Supporting Member
**
Posts: 1,126


Cat's Are Fun!

see users location on a map View Profile Give some DonationCredits to this forum member
« Reply #2 on: February 06, 2008, 05:19:42 AM »

I think I'm confusing Title line in the shortcut?

Anyway here's script on EjectCD

;EjectCD.ahk
; Ejects all CD drives, or add the drives to eject to the command line.
;  Example: EjectCD.exe E
;Skrommel @2006

list=%1%
If 0=0
  DriveGet,list,List,CDROM

Loop,Parse,list
  Drive,Eject,%A_LoopField%:


Thanks
Logged

If you need help - JUST ASK!
jgpaiva
Global Moderator
*****
Posts: 4,710



Artificial Idiocy

see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #3 on: February 06, 2008, 05:38:45 AM »

I know what the problem is. A recent ahk update broke the following line:

Which was supposed to check if there were no command line arguments.
Replace it with:
[copy or print]
if (list = "")
And it should be fixed Wink
Logged

CleverCat
Supporting Member
**
Posts: 1,126


Cat's Are Fun!

see users location on a map View Profile Give some DonationCredits to this forum member
« Reply #4 on: February 06, 2008, 05:47:42 AM »

Don't work  Sad

Code:

;EjectCD.ahk
; Ejects all CD drives, or add the drives to eject to the command line.
;  Example: EjectCD.exe E
;Skrommel @2006

list=%1%
if (list = "")
  DriveGet,list,List,CDROM

Loop,Parse,list
  Drive,Eject,%A_LoopField%:

« Last Edit: February 06, 2008, 05:49:26 AM by CleverCat » Logged

If you need help - JUST ASK!
CleverCat
Supporting Member
**
Posts: 1,126


Cat's Are Fun!

see users location on a map View Profile Give some DonationCredits to this forum member
« Reply #5 on: February 06, 2008, 05:55:54 AM »

Am I supposed to add something in the 'start in' or 'arguments' line on my shortcut?
Logged

If you need help - JUST ASK!
jgpaiva
Global Moderator
*****
Posts: 4,710



Artificial Idiocy

see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #6 on: February 06, 2008, 06:36:48 AM »

Oh, i thought you already were doing that!

Yes, in the "arguments" line, add the letter of the drive you want to eject!
(better add it with the ':' for example, e: )
Logged

CleverCat
Supporting Member
**
Posts: 1,126


Cat's Are Fun!

see users location on a map View Profile Give some DonationCredits to this forum member
« Reply #7 on: February 06, 2008, 07:36:30 AM »

Done that on open and close...

Still opening both?? Sad
Logged

If you need help - JUST ASK!
jgpaiva
Global Moderator
*****
Posts: 4,710



Artificial Idiocy

see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #8 on: February 06, 2008, 07:56:04 AM »

I made a small mistake, you're supposed to only use the drive letter (without the ':').

Does it close only one but open both of them?
Logged

lanux128
Global Moderator
*****
Posts: 6,089



see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #9 on: February 06, 2008, 12:42:21 PM »

CleverCat, how do you launch your EjectCD app, i mean by clicking on icon or via command-line and how many optical drives do you have? because the above if run by itself is designed eject all drives but you can insert drive parameters to selectively eject.

also, you can use a command-line tool called Eject to open/close a CD-ROM drive. this can be called via Farr alias as i did here thanks to jgpaiva.

Logged

CleverCat
Supporting Member
**
Posts: 1,126


Cat's Are Fun!

see users location on a map View Profile Give some DonationCredits to this forum member
« Reply #10 on: February 07, 2008, 06:32:47 AM »

Opens both/closes both... cheesy

Via Icon on Dock.

Trying to make it work thru farr - but I'm not really sure what I'm doing!  Grin
Logged

If you need help - JUST ASK!
CleverCat
Supporting Member
**
Posts: 1,126


Cat's Are Fun!

see users location on a map View Profile Give some DonationCredits to this forum member
« Reply #11 on: February 07, 2008, 06:44:24 AM »

I've downloaded eject - is it non install - do I place it where I want it? tellme

« Last Edit: February 07, 2008, 06:54:05 AM by CleverCat » Logged

If you need help - JUST ASK!
CleverCat
Supporting Member
**
Posts: 1,126


Cat's Are Fun!

see users location on a map View Profile Give some DonationCredits to this forum member
« Reply #12 on: February 09, 2008, 05:01:21 AM »

I've gone back to using Wizmo...

http://www.grc.com/wizmo/wizmo.htm

Working great.... Thmbsup
Logged

If you need help - JUST ASK!
johnnyzero
Participant
*
Posts: 24

View Profile Give some DonationCredits to this forum member
« Reply #13 on: July 12, 2008, 08:16:40 PM »

I'd like to modify your EjectCD script so that it will either eject or close a certain drive, depending on its current state. To toggle the drive's "tray state", if you will.

I've tried modifying your script by just adding "1" as the last argument (Drive,Eject,%A_LoopField%:,1). According to the AutoHotKey command docs, that argument should make the Eject command work the way I want.

Unfortunately, it doesn't work. My recompiled script will close the tray if it's open, but it won't eject it if it's closed. Any suggestions? As you can tell, I'm not an AutoHotkey scripting expert... smiley

best,
JohnB

btw, I've also made the if (list = "") change to your script, as mentioned in a previous post.
Logged
jgpaiva
Global Moderator
*****
Posts: 4,710



Artificial Idiocy

see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #14 on: July 13, 2008, 04:00:50 AM »

Hi johnnyzero!
From what I understand from reading the help file, the '0' is for eject and the '1' is for close.
You can try the following, though:

[copy or print]
{
Drive,Eject,%A_LoopField%:,0
if (Errorlevel = 0)
  Drive,Eject,%A_LoopField%:,1
}

Instead of the Drive,Eject line.
That'll check if the state of the drive changed, and if not, do the other command.
Logged

johnnyzero
Participant
*
Posts: 24

View Profile Give some DonationCredits to this forum member
« Reply #15 on: July 13, 2008, 10:53:28 AM »

Thanks for the reply, jgpaiva. Good idea - your code seems like it should work, but it didn't for me. Oh well...

I ended up using this rather clever example code from the AHK docs to create a hotkey-based script, converted it to an EXE, and I have the EXE autorun at system startup:

F11::
Drive, Eject
; If the command completed quickly, the tray was probably already ejected.
; In that case, retract it:

if A_TimeSinceThisHotkey < 1000 ; Adjust this time if needed.
     Drive, Eject,, 1
return

Works great - pressing F11 toggles my drive tray open/closed. That's actually more convenient than having to click on something.

best,
JohnB
Logged
Pages: [1]   Go Up
  Reply  |  New Topic  |  Print  
 
Jump to:  
   Forum Home   Thread Marks Chat! Downloads Search Login Register  

DonationCoder.com | About Us
DonationCoder.com Forum | Powered by SMF
[ Page time: 0.039s | Server load: 0.07 ]