Being able to send keys as though they were typed on a keyboard is really handy. It’s good for automating things. However, my favorite time to use it is when a website won’t allow you to paste in a password.


xdotool type 'your text here'

Just put this in any shell script; xdotool is a separate program.

Mac OS X

tell application "Chrome"
    tell application "System Events" to tell process "Chrome" to keystroke "your text here"
end tell

Run with

osascript <script name>


This particular example shows how to keep the screensaver from kicking in. However, a stripped-down version will just send the text.

Dim objResult

Set objShell = WScript.CreateObject("WScript.Shell")

Do While True
	objResult = objShell.sendkeys("{F15}")
	Wscript.Sleep (90000)

Put this in a file with the extension .vbs and run it from the command line (PowerShell).