你能解释一下传递价值的正确方法吗? (数组到

Can you explain me the correct way to pass the Value? (Array to

我不明白为什么它没有正确传递值。输出应为 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的“表达方式”,相当dirty/confusing。

并且,AutoHotkey 的索引是 OneBased Not ZeroBased,再次令人困惑。

最后,AutoHotkey

中不需要“Type”关键字

而不是:string output = S_Array[target]

你试过了吗:output := S_Array[target]

此外,您可能还想阅读:https://www.autohotkey.com/docs/misc/Arrays.htm