Hacker Typer style application for Windows
Yes, you can use AutoHotKey. I'm sure somebody else could whip this up in no time, but I can at least imagine a possible structure to the script:
- Define a Suspend hotkey and start suspended, so that you can use your keyboard when you don't want to be mashing. Alternatively, or in addition, use #IfWinActive to restrict the mashing-keys function to the one window within which you will be doing this.
- Read a plain-text file into memory.
- Stack multiple hotkey definitions for pretty much every key on the keyboard for your one script action.
- Use StringLeft and StringTrimLeft to retrieve a single character from your big variable and delete it from the variable.
- Use Send to send the character that you grabbed. You may need to do a little replacement or conditional to handle sending
{Enter}
and{Tab}
, but maybe not.
Here's my script:
#UseHook ; Avoid loops of the Send command triggering the hotkey again.
AutoTrim, Off ; Don't auto-trim spaces and tabs from the beginning and end of the sourcetext.
SendMode InputThenPlay ; Try to prevent the user from corrupting the buffer text.
Suspend, On ; Start suspended
FileRead, MasherBuffer, magic-button-masher-text.txt
if ErrorLevel
MasherBuffer = Type or paste text here. You can also drag-and-drop text files here.
Gui, +Resize +MinSize400x200
Gui, Add, Text,, When you are ready, un-suspend this script (Ctrl and `` together will toggle the suspension).`nType any character on the main QWERTY keyboard to send the characters from the buffer instead.
Gui, Add, Edit, vMasherBuffer, %MasherBuffer%
Gui, Show,, Magic Button Masher Buffer
Return
GuiSize:
if ErrorLevel = 1 ; The window has been minimized. No action needed.
return
; Otherwise, the window has been resized or maximized. Resize the MasherBuffer control to match.
NewWidth := A_GuiWidth - 20
NewHeight := A_GuiHeight - 50
GuiControl, Move, MasherBuffer, W%NewWidth% H%NewHeight%
return
GuiDropFiles:
Loop, parse, A_GuiEvent, `n
{
FileRead, AddToBuffer, %A_LoopField%
MasherBuffer = %MasherBuffer%`n`n%AddToBuffer%
}
GuiControl,, MasherBuffer, %MasherBuffer%
return
^`::Suspend
!`::Gui, Show,, Magic Button Masher Buffer
; #IfWinActive ahk_class Notepad ; This limits the button masher to Notepad.
`::
1::
2::
3::
4::
5::
6::
7::
8::
9::
0::
-::
=::
q::
w::
e::
r::
t::
y::
u::
i::
o::
p::
[::
]::
\::
a::
s::
d::
f::
g::
h::
j::
k::
l::
`;::
'::
z::
x::
c::
v::
b::
n::
m::
,::
.::
/::
Space::
GuiControlGet, MasherBuffer
StringLeft, outbound, MasherBuffer, 1
StringTrimLeft, MasherBuffer, MasherBuffer, 1
GuiControl,, MasherBuffer, %MasherBuffer%
if outbound = %A_Space%
Send {Space}
else if outbound = %A_Tab%
Send {Tab}
else
Send {%outbound%}
return
You can make this only work in Notepad by uncommenting the #IfWinActive bit.
I have Ctrl+` defined as a hotkey to suspend the script.