Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Applescript to "paste" clipboard

I am working on an Applescript to paste what was last copied to any current field. It is to be used with VoiceOver and the key code way (only way I know how) does not work all of the time.

    tell application "System Events" to key code 9 using command down

    say "paste"
like image 651
Elias Avatar asked Sep 09 '14 14:09

Elias


1 Answers

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
like image 174
ccpizza Avatar answered Nov 03 '22 00:11

ccpizza