Tag Archives: scripting

(Re-)Learning Apple Script to Automate Some Work

For a few things I use Apple Script to automate tasks. For instance if I start a new project, I run a script that creates basic things like folders, standard to-do’s and notes on my hard drive and in my Things and Evernote applications. They save me time and let me avoid a lot of repetitive work. I wrote those scripts years ago, and meanwhile I have forgotten what little I knew about Apple Script.

Now I’m trying to build a new script. I had thought about this already, then Frank Meeuwsen’s similar steps (in Dutch) triggered me to start.

During my reading online I save articles and documents into Evernote, which I tag and store.
I’d like to automatically create a Suggested Reading posting weekly based on what I save in Evernote. I imagine adding a specific tag for this to the things I save, so I can also save things without them showing up in such a posting. The articles I save usually have a short sentence about why it’s relevant to me.

This means:

  • Running the script automatically weekly
  • Selecting Evernote notes from the last 7 days with the right tag
  • From each Evernote extract the short descriptive sentence I added, the associated weblink, as well as other tags I added when saving.
  • Then build a bullet list, with the descriptive sentences as text, and the link embedded either at the end, with its title as text, or maybe embedded in the description, based on some sort of indication.
  • Select three random tags that occur at least twice in the list of links
  • Add those three tags as part of the title of the blog post
  • Add all tags used to the tags for the blogpost
  • Set Linklog as the Category
  • Save as draft in my WordPress blog, with a scheduled post date of 16 hours.
  • Send me a message inviting me to review the draft and post. (If I don’t review, the posting will thus automatically appear)

I used to use a bookmarking service like Delicious or Diigo, and there used to be ways, or maybe still are, to blog automatically from their service. However it would necessitate me to save everything twice: As a bookmark and as a full article in Evernote. (Saving the entire article circumvents issues with link rot and paywalls, and allows me local full text search in all my notes)

I’ll likely suffer hours of frustration trying to find out how to do things correctly in AppleScript. Any pointers to useful resources (example libraries for instance) are therefore welcome.

(And yes, I understand the discrepancy between wanting to write a script to work with Evernote, while simultaneously wanting to leave Evernote)