Question

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?

Was it helpful?

Solution

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).

OTHER TIPS

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top