|
CleverCat
|
 |
« on: February 05, 2008, 03:10:17 AM » |
|
Works great  but... Have changed script to reflect only one drive, but it still does 2 simultaneously? 
|
|
|
|
|
Logged
|
If you need help - JUST ASK!
|
|
|
|
lanux128
|
 |
« 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. 
|
|
|
|
|
Logged
|
|
|
|
|
CleverCat
|
 |
« 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
|
 |
« 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: And it should be fixed 
|
|
|
|
|
Logged
|
|
|
|
|
CleverCat
|
 |
« Reply #4 on: February 06, 2008, 05:47:42 AM » |
|
Don't work  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
|
 |
« 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
|
 |
« 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
|
 |
« Reply #7 on: February 06, 2008, 07:36:30 AM » |
|
Done that on open and close... Still opening both?? 
|
|
|
|
|
Logged
|
If you need help - JUST ASK!
|
|
|
|
jgpaiva
|
 |
« 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
|
 |
« 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
|
 |
« Reply #10 on: February 07, 2008, 06:32:47 AM » |
|
Opens both/closes both...  Via Icon on Dock. Trying to make it work thru farr - but I'm not really sure what I'm doing! 
|
|
|
|
|
Logged
|
If you need help - JUST ASK!
|
|
|
|
CleverCat
|
 |
« 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?  
|
|
|
|
« Last Edit: February 07, 2008, 06:54:05 AM by CleverCat »
|
Logged
|
If you need help - JUST ASK!
|
|
|
|
|
|
johnnyzero
|
 |
« 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...  best, JohnB btw, I've also made the if (list = "") change to your script, as mentioned in a previous post.
|
|
|
|
|
Logged
|
|
|
|
|
jgpaiva
|
 |
« 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
|
 |
« 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
|
|
|
|
|