2009-08-19 246 views
1

我想在AutoIt中編寫一個腳本,它可以從鍵盤自動輸入,比如說A-Z,而無需用戶干預。如何在AutoIt中使用鍵盤輸入?

這可能嗎?

+1

這個問題太不明確,無法回答。 – Bombe 2009-08-19 08:23:52

+1

你很難理解你所要求的是什麼。如果你能舉一個你想要做的例子,我相信我可以有更多的幫助。 @Bombe雖然AutoIt不會替代Java,但這對於Windows系統自動化任務來說是驚人的。 – Copas 2009-09-09 00:52:08

回答

4

您的程序不太可能需要捕獲所有密鑰的所有輸入。如果您確實需要這種用戶輸入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 

如果你想從一個非常容易的輸入框中接受用戶輸入。關於HotKeySet和的InputBox

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

更多信息可以在the AutoIt.chm help file(它實際上是一個很大的參考)中找到。

2

不知道我理解你的問題 - 你想模擬沒有人真的使用鍵盤的按鍵?如果是這樣,那麼AutoIt中的the send command

你想讓真正的用戶向腳本提交輸入嗎?這就是the GUI in AutoIt的用途。