函数和循环

时间:2015-05-03 22:49:48

标签: arrays function loops autoit

我正在尝试使函数_EncryptionProcess()逐个获取数组并处理它们。我意识到你不能在For循环中拥有函数。

需要采用数组的位置是键入$aArray的位置,数组存储在此值中。另一个变量定义了密钥大小和值。

;Cuts the input up into piece; 
$VariableToBeCut = "12345678"
$aArray = StringRegExp($VariableToBeCut, ".{2}", 3)
MsgBox(0, "die", $aArray[0]) ; personal check to make sure array works

$DataToBeEncrypted=_EncryptionProcess($aArray, $keyvalue, $keysize, 1) ;$aArray needs to be where the different arrays are processed
MsgBox(0, "Encrypted data", $DataToBeEncrypted)

1 个答案:

答案 0 :(得分:1)

这是你应该如何处理数组元素。

;Cuts the input up into piece;
$VariableToBeCut = "12345678"
$aArray = StringRegExp($VariableToBeCut, ".{2}", 3)

ConsoleWrite("Array element 0: " & $aArray[0] & @LF) ; personal check to make sure array works

For $i = 0 To UBound($aArray)-1

    $DataToBeEncrypted = _EncryptionProcess($aArray[$i], $keyvalue, $keysize, 1)

    ConsoleWrite("Element " & $i & " : " & $aArray[$i] & " DataToBeEncrypted: " & $DataToBeEncrypted & @LF)

Next