Sign in to follow this  
Followers 0
AutoMT

DriveStatus with blank disc

1 post in this topic

I have a function that tests if there is enough room for a certain file (variable $FinalFile) on a certain drive.

Func SetOpticalDrive()
    StartFunc("SetOpticalDrive()")
    $OpticalDrive = DriveGetDrive("CDROM")
    If Not @error Then
        For $i = 1 to $OpticalDrive[$i]
        Next
        $OpticalDrive = $OpticalDrive[$i]
        LogIt("Optical drive: " & $OpticalDrive)
        LogIt("Status: " & DriveStatus($OpticalDrive))
        LogIt("Type: " & DriveGetType($OpticalDrive))
        LogIt("Label: " & DriveGetLabel($OpticalDrive))
        LogIt("Total space: " & Round(DriveSpaceTotal($OpticalDrive), 1))
        $OpticalDriveFreeBytes = DriveSpaceFree($OpticalDrive) * 1048576
        $OpticalDriveFreeMB = Round(DriveSpaceFree($OpticalDrive), 1)
        LogIt("Free space: " & $OpticalDriveFreeMB & " MB (" & $OpticalDriveFreeBytes & " bytes)")
        LogIt("Free space raw: " & $OpticalDriveFreeBytes)
        TestOpticalDrive()
    EndIf
EndFuncoÝ÷ Ù8b±û§rبø§vÊ.·brk÷¢²íër¥ê®¢ÐDã*ºZÛazzîÆ{^²Û(+*.q©ìyàë÷µ«n²+-ê'xý¯x-®ì"¶¢¶ºYB)íçk÷®+ÞJÖ­ºÊÞ¶ê粫¨µ
®¢Õ¢¶azÚÚÊ^+kzÛ«Ê®¢ÓNM
®¢ÔáȬjYpzYZØ(¡Öî·^n¶)ÚnV§
âµæàÚÞ¶ê粫¨µCJ4åªê-jÌV¬ÒÚ-j[)iÇݭ笥§nëb¶ËbY'£-«mçk÷­Ê¢° Ñ8ÄáǺǬ¶§{_ºw-âl¬r¸©¶Ú-zYmë¬z¸§¶¬q«ëajÛaz·¢²z-zz.ëyë)iǨØ^v¸¯zÚ0®+^Ó~v¥)^¶­jëh×6Func TestOpticalDrive()
    StartFunc("TestOpticalDrive()")
    If DriveStatus($OpticalDrive) = "NOTREADY" Then
        LogIt("Optical drive not ready")
        MsgBox(48, "mp3Burn", "Optical drive not ready.  Check the drawer is closed and try again.")
    Else
        LogIt("Optical drive " & DriveStatus($OpticalDrive))
        If DriveSpaceFree($OpticalDrive) = 0 Then
            LogIt("Optical drive has no free space available")
            MsgBox(48, "mp3Burn", "Disc in " & $OpticalDrive & " is full.  Please insert a blank disc and try again.")
        ElseIf $FinalFileSizeBytes > $OpticalDriveFreeBytes Then
            LogIt("Not enough free space on " & $OpticalDrive & " for " & $FinalFile)
            MsgBox(48, "mp3Burn", "Not enough space on " & $OpticalDrive & " for " & $FinalFile)
        EndIf
    EndIf
EndFunc

Is this because the CD is completely blank and not finalised? Windows itself knows that the drive has 702 MB free space, shouldn't AutoIT know that too? Is it a problem with my code or can AutoIT just not do this kind of thing with blank mediums?

Share this post


Link to post
Share on other sites



Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0