Type your clipboard automatically with keystroke delay app for Apple Mac

I was faced with a huge annoyance when working with VMware VMs and trying to copy and paste into a VM console when using my MacBook.

After coming from Windows where someone had already developed an app that would paste back your last clipboard item with a 5 second delay (allowing you to put the mouse cursor in the right place) but in a delayed keystroke fashion. I found this a big annoyance of using a Mac.

I’ve also found this advantageous for pasting into DRAC/iLO consoles, password fields that don’t allow standard copy/paste, etc.

How did I achieve this?

Well I say “I”, but this was a joint effort between Google-Fu, my friend Matt Kubiak and myself. We found some code online, modified it further to include a 5 second delay and then compiled into an Apple App.

The Code

delay 5

set charList to {"0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "."}
set codeList to {29, 18, 19, 20, 21, 23, 22, 26, 28, 25, 47}
	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
		if (character i of getClip) is in charList then
			set codeItem to my listPosition(character i of getClip, charList)
			set keyCodeNum to item codeItem of codeList
			key code keyCodeNum
			keystroke (character i of getClip)
		end if
		delay 0.03
	end repeat
end tell

on listPosition(thisItem, thisList)
	repeat with n from 1 to the count of thisList
		if item n of thisList is thisItem then return n
	end repeat
	return 0
end listPosition

Paste the code in Apple Scripts and then Export as an Application. Change the icon, add to your quick launch bar and enjoy.

Download App

How To Use

  1. Copy the text you want to paste
  2. Double click on the App
  3. Put your cursor where you want to paste
  4. Wait 5 seconds
  5. Done

If you have any questions regarding this, feel free to leave a comment and I’ll get back to you ASAP.

Leave a Reply

Your email address will not be published. Required fields are marked *