【问题标题】:Functions and loops函数和循环
【发布时间】:2015-07-13 06:10:36
【问题描述】:

我正在尝试使函数_EncryptionProcess() 将数组 1 接 1 并处理它们。我意识到你不能在 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)

【问题讨论】:

  • 您可以在数组中使用函数。你只是不能在那里定义它们。你完全知道函数的使用方法吗?
  • 我想我知道如何使用函数但是你能帮我解决这个问题
  • 这是什么语言?它看起来像 PHP,除了 ;厘米。
  • @EvanCarslake 问题中使用的语言是 AutoIt 脚本。
  • @bahjat “不能在循环中使用函数”是什么意思?当然你可以在 AutoIt 的循环中调用一个函数。

标签: arrays function loops autoit


【解决方案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

【讨论】:

    猜你喜欢
    • 2015-11-10
    • 1970-01-01
    • 1970-01-01
    • 2020-05-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多