Reputation: 480
For reasons, I'm trying to create a python script which is going to spam opening and closing the CD drive. So far, I've found the following solution, which is utilized using ctypes
from this question.
import ctypes
#to open CD drive
ctypes.windll.WINMM.mciSendStringW(u"set cdaudio door ", None, 0, None)
#to close CD drive
ctypes.windll.WINMM.mciSendStringW(u"set cdaudio door closed", None, 0, None)
Both commands work fine. Yet, after putting them into a while loop so they can be run continuously, I ran into a problem. After closing, the CD drive seems to take quite a while before it opens again. Having done some searching, I found out this occurrs because the computer attempts to read the disk and takes some time to realize the drive is empty.
My question is, what can I use to avoid letting the computer try to read the drive? Is there any solution that can lead to the ability to spam the drive without waiting for anything to be read?
Cheers!
Upvotes: 0
Views: 2575