Created
February 17, 2019 12:52
-
-
Save somebody32/b1a7564298ff5bd82decd0fbbbfe83a3 to your computer and use it in GitHub Desktop.
Fluent typing effect with Automator
This file contains hidden or 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
const sysEvents = Application("System Events"); | |
sysEvents.includeStandardAdditions = true; | |
function typeWithDelay(text, delayValue = 0.02) { | |
if (delayValue) { | |
for (let i = 0; i < text.length; i++) { | |
sysEvents.keystroke(text[i]); | |
delay(delayValue); | |
} | |
} else { | |
sysEvents.keystroke(text); | |
} | |
} | |
function run(input, parameters) { | |
const stringToType = 'This string will be typed with a small delay between keystrokes ' + | |
'and then clipboard will be pasted '; | |
typeWithDelay(stringToType); | |
typeWithDelay(sysEvents.theClipboard(), false); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment