【问题标题】:What is Autoit equivalent for VBA Collection object?VBA Collection 对象的 Autoit 等效项是什么?
【发布时间】:2021-12-21 01:42:51
【问题描述】:

VBA Collection 对象的 Autoit 等效项是什么?

Dim CollArrays As New Collection 'VBA Collection

如何使用 Autoit 创建二维数组的集合?

添加更多细节。

#include <Array.au3>
_Example()

Func _Example()
    Local $a_1[2][2] = [[0, 1], [2, 3]]
    Local $a_2[2][2]= [[4, 5], [6, 7]]
    Local $a_3[2][2]= [[8, 9], [10, 11]]

    numRows = UBound($a_1(1), 1)
    numCols = UBound(@a_2(1), 2)

    Local $a_outer = [1 To (numRows*@a_outer.length)] [1 to numCols]

    ; get current $a_2
    $a_2 = $a_outer[1]

    ; add element to $a_2
    _ArrayAdd($a_2, 12, 13)

    ; put them back to $a_outer
    $a_outer[1] = $a_2

 EndFunc

 MsgBox(0, "", _Example())

写入错误。

【问题讨论】:

  • 你想做什么?您可以在 Autoit 中使用 Array.au3 和 _ArrayAdd 将项目添加到您的数组中。
  • 外来生物学家,目标:将​​多个 2D 阵列组合成单个 2D 阵列。
  • _ArrayConcatenate ???
  • 请注意,AutoIt-Arrays 能够保存数组(“数组数组”)
  • 异种生物学家,需要在循环 For Each 中使用 _ArrayAdd 并使用 UBound 2D 数组。

标签: vba autoit


【解决方案1】:
#include <Array.au3>

_Example()

Func _Example()
    Local $a_1[2] = [0, 1]
    Local $a_2[2] = [2, 3]
    Local $a_outer[2] = [$a_1, $a_2]
    
    ; get current $a_2
    $a_2 = $a_outer[1]
    
    ; add element to $a_2
    _ArrayAdd($a_2, 4)
    
    ; put them back to $a_outer
    $a_outer[1] = $a_2
    
EndFunc

【讨论】:

  • 外来生物学家,回答 need to use _ArrayAdd in loop For Each and use UBound 2D arrays 对您的情况很有用。
猜你喜欢
  • 1970-01-01
  • 2012-12-27
  • 2018-11-12
  • 2012-10-16
  • 2010-10-01
  • 2016-03-20
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多