Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/variables/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Variables 你能告诉我传递值的正确方法吗?(数组到_Variables_Autohotkey - Fatal编程技术网

Variables 你能告诉我传递值的正确方法吗?(数组到

Variables 你能告诉我传递值的正确方法吗?(数组到,variables,autohotkey,Variables,Autohotkey,我不明白它为什么不能正确传递值。输出应为word2 f12:: target = 1 string := "word1|word2|word3" S_Array := StrSplit(string, "|") string output = S_Array[target] MsgBox % "Output:" output return 当我使用 MsgBox % "Output:" S_Array[target] 取而代之的是,一切都很好

我不明白它为什么不能正确传递值。输出应为word2

 f12::
    target = 1
    string := "word1|word2|word3"
    S_Array := StrSplit(string, "|")
    string output = S_Array[target]
    MsgBox % "Output:" output
    return
当我使用

MsgBox % "Output:" S_Array[target]
取而代之的是,一切都很好。但我需要将其存储到输出。我正在尝试很长一段时间。

您必须熟悉AutoHotkey的“表达式样式”,这相当脏/混乱

而且,AutoHotkey的索引是基于一的而不是基于零的,同样令人困惑

最后,在自动热键中不需要“键入”关键字


而不是:
字符串输出=S\u数组[目标]

您是否尝试过:
output:=S\u数组[目标]

此外,您可能还想阅读: