如何调试"Subscript used on non-accessible variable"?



这是我的代码:

#RequireAdmin
#Region Directives created by AutoIt3Wrapper_GUI
#AutoIt3Wrapper_UseX64=n
#EndRegion Directives created by AutoIt3Wrapper_GUI
ListDrives("REMOVABLE")
ListDrives("FIXED")
Func ListDrives($type)
$drive = DriveGetDrive($type)
For $i = 1 To $drive[0]
MsgBox(64,"",$drive[$i])
Next
EndFunc

错误为:

(C:\Users\Javad\Desktop\01.au3"(7(:===>上使用的下标不可访问的变量。:

For $i = 1 To $drive[0]
For $i = 1 To $drive^ ERROR)

如何调试";不可访问变量"上使用的下标;?

也许您的驱动器不是可移动的,而是CD-ROM。试试这个看看你的驱动器。

#include <AutoItConstants.au3>
#include <MsgBoxConstants.au3>
#include <Array.au3>
$re = ListDrives($DT_ALL)
_ArrayDisplay($re, 'Drives and Drivetypes')
;~ ListDrives($DT_FIXED)
Func ListDrives($type)
Local $aArray = DriveGetDrive($type)
Local $drive_A[0][2]
If @error Then
; An error occurred when retrieving the drives.
MsgBox($MB_SYSTEMMODAL, "", "It appears an error occurred.")
Else
For $i = 1 To $aArray[0]
_ArrayAdd($drive_A, StringUpper($aArray[$i]) & '|' & DriveGetType($aArray[$i]))
Next
EndIf
Return $drive_A
EndFunc   ;==>ListDrives

相关内容

  • 没有找到相关文章

最新更新