applescript

Process automation in building Anki vocabulary cards

For the last two years, I’ve been working through a 10,000 word Russian vocabulary ordered by frequency. I have a goal of finishing the list before the end of 2019. This requires not only stubborn persistence but an efficient process of collecting the information that goes onto my Anki flash cards. My manual process has been to work from a Numbers spreadsheet. As I collect information about each word from several websites, I log it in this table.

AppleScript and iTerm2

Among the many reasons I use iTerm2 in lieu of the macOS Terminal is its AppleScript support. I recently had the need to automate some tasks on my Amazon Web Services EC2 server in a way that takes advantage of iTerm2 AppleScript functionality. Use case I’ve found recently, that my screen sessions were disappearing. Although I haven’t completely excluded other causes, some have suggested that infrequently-reconnected sessions can be cleaned up.

Extracting mp3 file from web page with Python and ApplesScript

As I’ve mentioned before I use Anki extensively to memorize and practice Russian vocabulary. With language learning in particular, adding spoken pronunciations to the cards makes an enormous difference. Since I use Open Russian extensively to provide information to built my Anki cards, it’s a natural source of audio data, too. To optimize my learning time, I built two small scripts to grab and rename the audio files from the Open Russian site.

Using Python and AppleScript to get notified if a site is down

I manage a handful of websites, like this one. Having built a few on other platforms, such as Drupal, I’m familiar with the dreaded error “The website encountered an unexpected error. Please try again later." On sites that I don’t check on frequently, it can be an embarrassment when people begin emailing you with questions about the site being down. I wrote the following Python script to deal with the problem:

Import and tag with Hazel and DEVONthink Pro Office

Hazel and DEVONthink make a great pair as I’ve written before. Using AppleScript, it’s possible to take the import workflow even further by tagging incoming files automatically. Use case I download a lot of mp3 files containing pronunciation of words in a language I’ve been learning. I keep a record of these words and tag them appropriately using my hierarchical tagging system. I’d like to download the files to a directory on the desktop.

Using AppleScript with MailTags

I’m a fan of using metadata to classify and file things rather than declarative systems of nested folders. Most of the documents and data that I store for personal use are in DEVONthink which has robust support for metadata. On the email side, there’s MailTags which lets you apply metadata to emails. Since MailTags also supports AppleScript, I began to wonder whether it might be possible to script workflows around email processing.

Waking the computer to allow AppleScript to run

I have a number of AppleScript applications that need to run at odd times. These maintenance tasks often attempt to run while the computer is sleeping. Particularly those that rely on UI scripting do not function during this period. This most flexible way of dealing with this is to manipulate the power management settings directly via the pmset(1) command. The variety of options available using pmset is staggering and beyond the scope of this post.

An easier way to automate synchronization of Anki profiles with AppleScript

After waking up this morning with my mouse locked onto the Anki icon in the dock and trying to figure out how to get Activity Monitor up and running so I could force quite my Automator application that I described yesterday I figured it was back-to-the-drawing board. I’d like to have used the Accessibility Inspector to manipulate the PyQt objects in Anki’s windows, they aren’t exposed in a may that you can script them.