8

I am creating some screencasts and as I have been doing this I realized that there must be some way of pasting code from pasteboard and having it appear in my text editor as though I'm typing it so that my typing is more fluid...

Unfortunately I've not found any solutions yet. Anyone seen any software that does something along these lines?

Again, the desired effect is upon paste or some key combo it will type what I have in the pasteboard buffer to whatever text field or editor I have up.

1 Answer 1

7

You can use an Applescript (free, built into System 7, Mac OS 8, Mac OS 9, Mac OS X) script:

Applescript:
try
   the clipboard as text
on error
   set the clipboard to " "
end try

tell application "System Events"
   keystroke (the clipboard as text)
end tell

To add some delay between each keystroke:

Applescript:
try
   set getClip to the clipboard as text
on error
   set getClip to " "
end try

tell application "System Events"
   repeat with i from 1 to count characters of getClip
       keystroke (character i of getClip)
       delay 0.03
   end repeat
end tell

(Source)

(no Mac right now around me to debug)

On Windows you can do pretty much the same with AutoHotKey.

2
  • 1
    Sorry for the late acceptance; forgot about this question some time ago and came back to it later on again. Applescript seems to work well for this task, thanks.
    – GDP2
    May 14, 2016 at 21:48
  • 1
    This is such a lifesaver. The delay is also vital for doing paste over slow RDP sessions from a Mac, where clipboard integration is either missing or paste is disabled internally on the host being RDPed to. So not just for aesthetic reasons.
    – Wildcard
    Sep 15, 2023 at 20:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.