我想用AutoIt写一个脚本,它可以从键盘自动输入,比如说A-Z,而不需要用户干预。
这个是可能的吗?
发布于 2009-09-09 00:49:04
您的程序不太可能需要捕获来自所有键的所有输入。如果您确实需要这种用户输入,AutoIt可能不适合您-请参阅the post from the author of AutoIt about keyloggers。如果您需要使用热键类型的键盘输入:在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的更多信息可以在the AutoIt.chm help file中找到(它实际上是一个很好的参考资料)。
发布于 2009-08-19 11:23:33
我不太明白你的问题--你想在没有人实际使用键盘的情况下模拟按键吗?如果是这样,那就是AutoIt中的the send command。
您想让真正的用户向脚本提交输入吗?这就是the GUI in AutoIt的作用。
https://stackoverflow.com/questions/1298477
复制相似问题