AutoIT 访问二维数组值
AutoIT Access 2D Array Value
如何访问二维数组我想从数组位置 [3][3] 获取字符串 dog 并将其存储在变量中。这是我的代码
#include <Array.au3>
#include <IE.au3>
Local $aTableData
Local $oIE = _IE_Example("table")
Local $oTables = _IETableGetCollection($oIE)
For $oTable In $oTables
If $oTable.id == "tableOne" Then
$aTableData = _IETableWriteToArray($oTable)
ExitLoop
EndIf
Next
_ArrayDisplay($aTableData)
_IEQuit($oIE)
我认为这样的事情会奏效,但事实并非如此
Local $oDog = $aTableData[3][3]
数组
An Array is a variable containing series of data elements. Each
element in this variable can be accessed by an index number.
一个例子:
您想存储一系列字符:"A", "U", "T", "O", "I", "T"
和 "3"
。您可以使用七个单独的变量来执行此操作,但使用数组更有效:
$aArray[0] = "A"
$aArray[1] = "U"
..etc..
$aArray[6] = "3"
要访问数组中的特定值,请使用索引号:
$sString = $aArray[2]
这导致 $sString 包含字母 "T"
您的代码:
#include <Array.au3>
#include <IE.au3>
Local $aTableData
Local $oIE = _IE_Example("table")
Local $oTables = _IETableGetCollection($oIE)
For $oTable In $oTables
If $oTable.id == "tableOne" Then
$aTableData = _IETableWriteToArray($oTable)
ExitLoop
EndIf
Next
Local $oDog = $aTableData[3][3]
ConsoleWrite($oDog)
_ArrayDisplay($aTableData)
_IEQuit($oIE)
如何访问二维数组我想从数组位置 [3][3] 获取字符串 dog 并将其存储在变量中。这是我的代码
#include <Array.au3>
#include <IE.au3>
Local $aTableData
Local $oIE = _IE_Example("table")
Local $oTables = _IETableGetCollection($oIE)
For $oTable In $oTables
If $oTable.id == "tableOne" Then
$aTableData = _IETableWriteToArray($oTable)
ExitLoop
EndIf
Next
_ArrayDisplay($aTableData)
_IEQuit($oIE)
我认为这样的事情会奏效,但事实并非如此
Local $oDog = $aTableData[3][3]
数组
An Array is a variable containing series of data elements. Each element in this variable can be accessed by an index number.
一个例子:
您想存储一系列字符:"A", "U", "T", "O", "I", "T"
和 "3"
。您可以使用七个单独的变量来执行此操作,但使用数组更有效:
$aArray[0] = "A"
$aArray[1] = "U"
..etc..
$aArray[6] = "3"
要访问数组中的特定值,请使用索引号:
$sString = $aArray[2]
这导致 $sString 包含字母 "T"
您的代码:
#include <Array.au3>
#include <IE.au3>
Local $aTableData
Local $oIE = _IE_Example("table")
Local $oTables = _IETableGetCollection($oIE)
For $oTable In $oTables
If $oTable.id == "tableOne" Then
$aTableData = _IETableWriteToArray($oTable)
ExitLoop
EndIf
Next
Local $oDog = $aTableData[3][3]
ConsoleWrite($oDog)
_ArrayDisplay($aTableData)
_IEQuit($oIE)