如何在 AutoHotkey 中读取多行用户输入?

How can I read multiple lines of user input in AutoHotkey?

我有一个 AutoHotkey 脚本需要从用户读取多行员工数据。

InputBox, userInput, Employee Records, Please enter employee records. (One per line)

不幸的是,InputBox 只允许用户输入一行文本。尝试使用 Enter 添加换行符将提交已输入的任何数据。

如何在 AutoHotkey 脚本中接收多行用户输入?

这里演示了多行输入框

F2::
  Gui, Add, Text,, Please enter employee records (One per line):
  Gui, Add, Edit, w600 h60 vinput
  Gui, Add, Button, gokay_pressed, Okay
  Gui, Add, Button, cancel X+8 YP+0, Cancel
  Gui, Show, Center autosize, Employee Records
  Return

okay_pressed:
  Gui Submit
  Gui Destroy
  MsgBox %input%
  Return

GuiClose:
GuiEscape:
ButtonCancel:
  Gui, Destroy
  return

这实现了通用的多行输入功能

F3::MsgBox % MultiLineInput( "Employee Records", "Please enter employee records (One per line):" )

MultiLineInput(title, prompt)
{
  static input
  input := ""
  Gui, Add, Text,, %prompt%
  Gui, Add, Edit, w400 h60 vinput
  Gui, Add, Button, gokay_pressed, Okay
  Gui, Add, Button, cancel X+8 YP+0, Cancel
  Gui, Show, Center autosize, %title%
  WinWaitClose %title%
  return input

  okay_pressed:
    Gui Submit
    Gui Destroy
    return

  GuiClose:
  GuiEscape:
  ButtonCancel:
    Gui, Destroy
    return
}