Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #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
- FileRead, text, C:test.txt
- /* Alternatively:
- text =
- (ltrim
- this is the first sentence.
- sentence 2 here.
- sentence 3 hello.
- sentence 4 reporting in.
- )
- */
- pos := 1
- StringSplit, lines, text, `n
- ^Space:: ; Ctrl + Space
- line := lines%pos%
- loop, Parse, line
- {
- SendInput % A_Loopfield
- Sleep 100 ; Adjust this for delay between keys
- }
- ++pos
- Return
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement