如何在 AutoIt 中进行键盘输入?

发布于 2024-08-02 10:47:24 字数 65 浏览 3 评论 0原文

我想在 AutoIt 中编写一个脚本,它可以从键盘自动输入,比如说 AZ,无需用户干预。

这可能吗?

I want to write a script in AutoIt, which can take automatic input from the keyboard, let's say A-Z, without user intervention.

Is this possible?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

守不住的情 2024-08-09 10:47:24

您的程序不太可能需要捕获所有按键的所有输入。如果您确实需要这种用户输入,AutoIt 可能不适合您 - 请参阅 AutoIt 作者关于键盘记录器的帖子。如果您需要采用热键类型的键盘输入:在 AutoIt 中执行此操作非常简单。

HotKeySet("^+{q}", "reactionFunction")

While 1
    ; A loop
WEnd

Func reactionFunction()
    MsgBox(0, "You pressed CTRL+Shift+q", "You pressed CTRL+Shift+q")
    Exit
EndFunc

如果您想从输入框中获取用户输入,这也很容易。

$data = InputBox("Enter Something", "Enter some data in the field below.")
MsgBox(0, "The String You Entered...", "The string you entered is... " & $data)

有关HotKeySet和InputBox的更多信息可以在AutoIt.chm帮助文件中找到(它实际上是一个很好的参考)。

It is unlikely that your program needs to capture all input from all keys. If you do in fact need that kind of user input AutoIt might not be for you - see the post from the author of AutoIt about keyloggers. If you need to take keyboard input of the hotkey type: doing that in AutoIt is super easy.

HotKeySet("^+{q}", "reactionFunction")

While 1
    ; A loop
WEnd

Func reactionFunction()
    MsgBox(0, "You pressed CTRL+Shift+q", "You pressed CTRL+Shift+q")
    Exit
EndFunc

If you want to take user input from an input box that is really easy also.

$data = InputBox("Enter Something", "Enter some data in the field below.")
MsgBox(0, "The String You Entered...", "The string you entered is... " & $data)

More information about HotKeySet and InputBox can be found in the AutoIt.chm help file (it's actually a great reference).

初见 2024-08-09 10:47:24

不确定我是否理解您的问题 - 您想在没有人实际使用键盘的情况下模拟按键吗?如果是这样,那就是 AutoIt 中的发送命令

您想让真实用户向脚本提交输入吗?这就是 AutoIt 中的 GUI 的用途。

Not sure I understand your question - you want to simulate keypresses without someone actually using the keyboard? If so, that's the send command in AutoIt.

You want to let a real user submit input to the script? That's what the GUI in AutoIt is for.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文