I would like to be able to use AppleScript to paste the clipboard's text into the foreground application. Every solution I can find online uses tell app "System Events" to keystroke "v" using command down. However, I am running this script with a keyboard shortcut, so I may already be holding down keys when this command fires, which makes the paste fail because more keys are pressed than just cmd and v. I know that I can use delay to give myself time to release the keys, but that feels like a hack (and ideally the paste would be instantaneous).

Is there a way to use AppleScript to paste without simulating the shortcut cmd-v? Thanks.

Edit: Also, if there is a way to use AppleScript to copy selected text without simulating cmd-c, that would be much appreciated as well.

  • Is using clipboard okay or does it need to be without clipboard?
    – JMY1000
    Commented May 4, 2016 at 2:52
  • A solution without the clipboard (like setting a variable to a string and then printing it) is also fine. Commented May 4, 2016 at 4:06

1 Answer 1


I managed to find the following solution.

tell application "System Events" to tell process (name of current application)
    tell menu bar item "Edit" of menu bar 1
        click menu item "Paste" of menu 1
    end tell
end tell

delay 0.1

The delay is there to give the system time to copy before using the clipboard.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .