如何在AutoHotkey中读取多行用户输入? [英] How can I read multiple lines of user input in AutoHotkey?

查看:326
本文介绍了如何在AutoHotkey中读取多行用户输入?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I have an AutoHotkey script which needs to read multiple lines of employee data from a user.

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

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

Unfortunately, an InputBox only allows users to enter a single line of text. Trying to add newlines with Enter will instead submit whatever data has been entered.

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

推荐答案

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

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
}

这篇关于如何在AutoHotkey中读取多行用户输入?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆