Advertisement
Guest User

Untitled

a guest
Jun 16th, 2019
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.22 KB | None | 0 0
  1. #UseHook ; Avoid loops of the Send command triggering the hotkey again.
  2. AutoTrim, Off ; Don't auto-trim spaces and tabs from the beginning and end of the sourcetext.
  3. SendMode InputThenPlay ; Try to prevent the user from corrupting the buffer text.
  4.  
  5. Suspend, On ; Start suspended
  6.  
  7. FileRead, MasherBuffer, magic-button-masher-text.txt
  8. if ErrorLevel
  9. MasherBuffer = Type or paste text here. You can also drag-and-drop text files here.
  10.  
  11. Gui, +Resize +MinSize400x200
  12. 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.
  13. Gui, Add, Edit, vMasherBuffer, %MasherBuffer%
  14. Gui, Show,, Magic Button Masher Buffer
  15. Return
  16.  
  17. GuiSize:
  18. if ErrorLevel = 1 ; The window has been minimized. No action needed.
  19. return
  20. ; Otherwise, the window has been resized or maximized. Resize the MasherBuffer control to match.
  21. NewWidth := A_GuiWidth - 20
  22. NewHeight := A_GuiHeight - 50
  23. GuiControl, Move, MasherBuffer, W%NewWidth% H%NewHeight%
  24. return
  25.  
  26. GuiDropFiles:
  27. Loop, parse, A_GuiEvent, `n
  28. {
  29. FileRead, AddToBuffer, %A_LoopField%
  30. MasherBuffer = %MasherBuffer%`n`n%AddToBuffer%
  31. }
  32. GuiControl,, MasherBuffer, %MasherBuffer%
  33. return
  34.  
  35. ^`::Suspend
  36.  
  37. !`::Gui, Show,, Magic Button Masher Buffer
  38.  
  39. ; #IfWinActive ahk_class Notepad ; This limits the button masher to Notepad.
  40. `::
  41. 1::
  42. 2::
  43. 3::
  44. 4::
  45. 5::
  46. 6::
  47. 7::
  48. 8::
  49. 9::
  50. 0::
  51. -::
  52. =::
  53. q::
  54. w::
  55. e::
  56. r::
  57. t::
  58. y::
  59. u::
  60. i::
  61. o::
  62. p::
  63. [::
  64. ]::
  65. ::
  66. a::
  67. s::
  68. d::
  69. f::
  70. g::
  71. h::
  72. j::
  73. k::
  74. l::
  75. `;::
  76. '::
  77. z::
  78. x::
  79. c::
  80. v::
  81. b::
  82. n::
  83. m::
  84. ,::
  85. .::
  86. /::
  87. Space::
  88. GuiControlGet, MasherBuffer
  89. StringLeft, outbound, MasherBuffer, 1
  90. StringTrimLeft, MasherBuffer, MasherBuffer, 1
  91. GuiControl,, MasherBuffer, %MasherBuffer%
  92. if outbound = %A_Space%
  93. Send {Space}
  94. else if outbound = %A_Tab%
  95. Send {Tab}
  96. else
  97. Send {%outbound%}
  98. return
  99.  
  100. FileRead, text, C:test.txt
  101. /* Alternatively:
  102. text =
  103. (ltrim
  104. this is the first sentence.
  105. sentence 2 here.
  106. sentence 3 hello.
  107. sentence 4 reporting in.
  108. )
  109. */
  110.  
  111. pos := 1
  112. StringSplit, lines, text, `n
  113.  
  114. ^Space:: ; Ctrl + Space
  115. line := lines%pos%
  116. loop, Parse, line
  117. {
  118. SendInput % A_Loopfield
  119. Sleep 100 ; Adjust this for delay between keys
  120. }
  121. ++pos
  122. Return
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement