Applescript to "paste" clipboard

I use keystroke:

tell application "System Events" to keystroke "v" using command down

I'm not aware of an error you should get, so you'll have to share.


There is a direct way to access the clipboard via the the clipboard keyword:

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

Reference:

  • https://developer.apple.com/library/archive/documentation/AppleScript/Conceptual/AppleScriptLangGuide/reference/ASLR_cmds.html#//apple_ref/doc/uid/TP40000983-CH216-SW28