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:
; 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
Works great - pressing F11 toggles my drive tray open/closed. That's actually more convenient than having to click on something.