Skip navigation

Trying to paste clipboard info into TextEdit

682 Views 4 Replies Latest reply: Oct 13, 2012 4:39 PM by UBGA RSS
UBGA Level 1 Level 1 (0 points)
Currently Being Moderated
Oct 13, 2012 3:57 PM

I am new to AppleScript, but from what I've been reading, this should a fairly simple task. I'm trying to do the following:

  • Create a new TextEdit document
  • Paste the contents fo the clipboard into the document

Current system configuration:

  • iMac with an Intel Core i5
  • OS X 10.8
  • "Enable access for assistive devices"  in System Preferences is checked.


This is the code I am using:

tell application "TextEdit"


          tell application "System Events"

                    tell process "TextEdit" to keystroke "V" using {command down}

          end tell


end tell


The code compiles without any issues. When I run the scrip in AppleScript Editor, it starts TextEdit and then I hear a beep. When I export the script as an application and run it, TextEdit starts, I do not hear a beep, but no text is pasted. I appears that the TextEdit program does not have the focus when the paste command attempts to run.

Any help would be greatly appreciated!

OS X Mountain Lion (10.8)


More Like This

  • Retrieving data ...

Bookmarked By (1)


  • This solved my question - 10 points
  • This helped me - 5 points
This site contains user submitted content, comments and opinions and is for informational purposes only. Apple disclaims any and all liability for the acts, omissions and conduct of any third parties in connection with or related to your use of the site. All postings and use of the content on this site are subject to the Apple Support Communities Terms of Use.