Last active
August 16, 2024 04:14
-
-
Save JamoCA/1d6d4a14b3ccfd9b3a0bf94db0c447ed to your computer and use it in GitHub Desktop.
AutoHotKey Script to emulate typing. Use CTRL+SHIFT+V to paste clipboard character-by-character as if typing.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
^+v:: ; paste text and emulate typing (CTRL+SHIFT+V) | |
AutoTrim,On | |
string = %clipboard% | |
Gosub,ONLYTYPINGCHARS | |
StringSplit, charArray, string | |
Loop %charArray0% | |
{ | |
this_char := charArray%a_index% | |
Send {Text}%this_char% | |
Random, typeSlow, 1, 3 | |
typeMin = 50 | |
typeMax = 150 | |
if (typeSlow >= 3){ | |
typeMin = 150 | |
typeMax = 350 | |
} | |
Random, t, typeMin, typeMax | |
Sleep, %t% | |
} | |
Return | |
ONLYTYPINGCHARS: | |
AutoTrim,Off | |
StringCaseSense,On | |
StringReplace,string,string,–,-,All ;emdash | |
StringReplace,string,string,´,',All | |
StringReplace,string,string,’,',All | |
StringReplace,string,string,©,(C),All | |
StringReplace,string,string,“,",All ;left quote | |
StringReplace,string,string,”,",All ;right quote | |
StringReplace,string,string,®,(R),All | |
StringReplace,string,string,¼,1/4,All | |
StringReplace,string,string,½,1/2,All | |
StringReplace,string,string,¾,3/4,All | |
StringReplace,string,string,™,TM,All | |
StringReplace,string,string,«,<<,All | |
StringReplace,string,string,»,>>,All | |
StringReplace,string,string,„,',All | |
StringReplace,string,string,•,-,All ;bullet | |
StringReplace,string,string,…,...,All | |
StringReplace,string,string,`r`n,`n,All ;replace newlines | |
StringReplace,string,string,chr(0),A_Space,All ;NULL | |
StringReplace,string,string,chr(9),A_Space,All ;Horizontal Tab | |
StringReplace,string,string,chr(10),A_Space,All ;Line Feed | |
StringReplace,string,string,chr(11),A_Space,All ;Vertical Tab | |
StringReplace,string,string,chr(14),A_Space,All ;Column Break | |
StringReplace,string,string,chr(160),A_Space,All ;Non-breaking space | |
Return |
Consult the AutoHotKey documentation. To do this, you'd need to use WinGetActiveTitle
and then use IfInString
(or If Title contains
) to check against a list of allowed window names.
For example, if you wanted this to work with app that have a window title that contain the text "Visual Studio Code", you could use:
WinGetActiveTitle, Title
IfInString, Title, Visual Studio Code
{
; all of the logic
}
Good script, I changed for my personal use line 9 to Send {Text}%this_char% so it sends any special char like + or ! as text when you paste them
@Calamardins Good catch! I've updated the gist.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Is there a way to have this only activate in certain Windows or applications, but not override the hotkey in other Windows?