Opened 15 years ago
Closed 15 years ago
#1860 closed Bug (Fixed)
DriveStatus Returns Ready with blank value
| Reported by: | Owned by: | Jon | |
|---|---|---|---|
| Milestone: | 3.3.7.2 | Component: | AutoIt |
| Version: | 3.3.6.1 | Severity: | None |
| Keywords: | Cc: |
Description
I am trying to do code similar to the below.
When the registry key does not exist, I get the status "READY" back.
If my combination of statements means this is not a bug, I would like to request that this report be changed to a feature request for the below to work properly.
If DriveStatus(Regread("HKLM\Software\ABC","DriveLetter")) = "READY" Then $ABCDriveAvailable = True
Thanks much.
Attachments (0)
Change History (3)
comment:1 by , 15 years ago
comment:2 by , 15 years ago
Forget my last comment.
That looks like a bug in the DriveStatus function to me and it can be duplicated with
MsgBox(4096, "Drive Status", DriveStatus(""))
A work around is to verify that the drive exists
$sDrive = Regread("HKLM\Software\ABC","DriveLetter")
If FileExists($sDrive) Then
MsgBox(4096, "Drive Status", DriveStatus($sDrive))
EndIf
comment:3 by , 15 years ago
| Milestone: | → 3.3.7.2 |
|---|---|
| Owner: | set to |
| Resolution: | → Fixed |
| Status: | new → closed |
Fixed by revision [5991] in version: 3.3.7.2

What you have should work fine providing the information being returned from your RegRead() is correct. It should return in the format G:\ or just G: If it returns anything else including "G:" then you will have to fix the registry return to make it work.
$sDrive = StringRegExpReplace(Regread("HKLM\Software\ABC","DriveLetter"), "(?i)^.*([a-z]).*", "$1:") If DriveStatus($sDrive) = "ready" Then $ABCDriveAvailable = TrueYou will have to provide an actual return value before this can really be checked.