如何判断光驱里面是否有光盘存在?
判断光驱里面是否有光盘存在,用.vbs可以这样判断:dim fso
dim d
set fso=createobject("scripting.filesystemobject")
for each d in fso.drives
if d.drivetype=4 then
if d.isready then
msgbox "有光盘!"
else
msgbox "无光盘"
end if
end if
next
---------------------
不知道用.au3怎么判断?或者如何将上面的.vbs转换为.au3?
请教了,谢谢! 这个函数不能用吗?
DriveStatus $var = DriveGetDrive("cdrom")
For $i = 1 To $var
$status = DriveStatus($var[$i])
If $status = "ready" Then
MsgBox(0, "", $var[$i] & " 盘里有光盘")
ElseIf $status = "NOTREADY" Then
MsgBox(0, "", $var[$i] & " 盘里没有光盘")
EndIf
Next 非常感谢dyljf,谢谢指导 3# dyljf
如果没有光驱呢?
该怎么写啊
$var = DriveGetDrive( "cdrom" )
If @error Then
MsgBox(0,"","本机没有光驱")
Exit
EndIf
For $i = 1 To $var
$status = DriveStatus($var[$i])
If $status = "ready" Then
MsgBox(0, "", $var[$i] & " 盘里有光盘")
ElseIf $status = "NOTREADY" Then
MsgBox(0, "", $var[$i] & " 盘里没有光盘")
EndIf
Next
页:
[1]