StringUpper($aDrives[$i])转换问题
$sDrive = StringUpper($aDrives[$i])将磁盘分区数组转换成字符串
但我一直没办法把字符串转换成 数字例如
C: 等于 1:1
D: 等于1:2
求大神给个灵感。
源代码如下:
$aDrives = DriveGetDrive('FIXED')
For $i = 1 To $aDrives
$sDrive = StringUpper($aDrives[$i]);定义变量并把数值转换成字符串主要是返回盘符
Next #include <Array.au3>
_ArrayDisplay(_DrivesToNum(), '')
Func _DrivesToNum($iDrive = 1)
Local $aDrives = DriveGetDrive('FIXED')
If @error Then Return SetError(1)
Local $sIx = $iDrive & ':', $ix = 1, $aNum[$aDrives + 1] = [[$aDrives]]
For $i = 1 To $aDrives
$aNum[$ix] = StringUpper($aDrives[$i])
$aNum[$ix] = $sIx & $ix
$ix += 1
Next
Return $aNum
EndFunc ;==>_DrivesToNum 回复 2# afan
>运行 AU3Check (3.3.9.5) 开始目录:C:\autoit3
"C:\Users\Telecom\Desktop\新建 AutoIt v3 脚本 (2).au3"(2,33) : error: _ArrayDisplay() called with expression on Const ByRef-param(s).
_ArrayDisplay(_DrivesToNum(), '')
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
"C:\autoit3\Include\Array.au3"(322,170) : 引用: 定义为 _ArrayDisplay().
Func _ArrayDisplay(Const ByRef $avArray, $sTitle = Default, $iItemLimit = Default, $iTranspose = Default, $sSeparator = Default, $sReplace = Default, $sHeader = Default)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
C:\Users\Telecom\Desktop\新建 AutoIt v3 脚本 (2).au3 - 1 错误, 0 警告 用 SciTE 就要养成点击“继续执行”的习惯。
一切以 AutoIt解释器为准。 回复 2# afan
>运行 AU3Check (3.3.9.5) 开始目录:C:\autoit3
"C:\Users\Telecom\Desktop\新建 AutoIt v3 脚本 (2).au3"(2,33) : error: _ArrayDisplay() called with expression on Const ByRef-param(s).
_ArrayDisplay(_DrivesToNum(), '')
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
"C:\autoit3\Include\Array.au3"(322,170) : 引用: 定义为 _ArrayDisplay().
Func _ArrayDisplay(Const ByRef $avArray, $sTitle = Default, $iItemLimit = Default, $iTranspose = Default, $sSeparator = Default, $sReplace = Default, $sHeader = Default)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
C:\Users\Telecom\Desktop\新建 AutoIt v3 脚本 (2).au3 - 1 错误, 0 警告
亲我搞定了 我多写了一个变量在里面 就解决了 谢谢
页:
[1]