问题描述
我需要将文本(EditBox GUI 元素)中的每一行存储到一个数组中。用户将在每一行中键入句子,每一行都需要存储在数组中。这是我的意思的一个例子:
Gui Add,Edit,xs R20 w550 vArrayTextArea,This needs to be the first item in array`n This needs to
be the second item in array `nThis needs to be the thrid item in array..
; Button
Gui Add,Button,w350 gCreateScript xs,BUTTON
Gui Show
Return
CreateScript:
Gui Submit,NoHide
global ArrayEdit:=ArrayTextArea
Return
解决方法
例如 Gui,Add,Edit,R20 w550 vArrayTextArea,% "Line1`nLine2`nLine3"
Gui,Button,w350 gCreateScript,BUTTON
Gui,Show
Return
CreateScript:
Gui,Submit,NoHide
LineArray := StrSplit(ArrayTextArea,"`n","`r")
for each,line in LineArray
MsgBox,% line
Return
(docs) 很容易做到这一点。
示例脚本:
{{1}}