harryboyd

Q: Exporting TextEdit document with Applescript

All I want to do is export a TextEdit document as a pdf, a simple menu command, but can't seem to work out how. I've been looking around but I can't seem to find anything anywhere on this, maybe I'm looking in the wrong places but I assume something like this would be fairly straight forward. I assume someone somewhere has done this before, please help...

 

Thanks!

 

(I have been working with applescript for a little while so I have a basic understanding.)

 

P.s. Sorry if this is posted in the wrong space, I couldn't find an applescript section...

MacBook Pro with Retina display, OS X Yosemite (10.10.5)

Posted on Sep 13, 2016 10:38 PM

Close

Q: Exporting TextEdit document with Applescript

  • All replies
  • Helpful answers

  • by harryboyd,

    harryboyd harryboyd Sep 14, 2016 12:26 AM in response to harryboyd
    Level 1 (4 points)
    Mac OS X
    Sep 14, 2016 12:26 AM in response to harryboyd

    Aaaah don't worry team, problem solved. Turns out the problem was with the "..." in "Export as PDF...". It's made by pressing option+; which creates the "…". So this script worked:

     

    tell application "System Events" to tell process "TextEdit"

      click menu item "Export as PDF…" of menu 1 of menu bar item "File" of menu bar 1

    end tell