Applescript
Getting plain text into Anki: a saga
Creating year and month groups in DEVONthink Pro Office using AppleScript
Deleting cookies with AppleScript
A couple years ago I wrote about a method for deleting cookies from Safari on macOS by employing AppleScript. Now I have a new script that works on OS X 10.14 Mojave. There are ways of surgically removing cookies, but honestly most sites leave so many cookies on my machine that I have no idea what any of them do and to what extent they use them to track me.
Safari
Here’s the script for Safari. Install it in ~/Library/Scripts/Applications/Safari
(or really, wherever you like.) When launched from the scripts menu in the menu bar, it will close all current tabs and delete every cookie that Safari has saved. Since it employs UI scripting, you’ll need to give it accessibility permissions when asked.
Automate iTunes for chorus repetitions of L2 pronunciation practice
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. Since I’m not a Unix sysadmin, I’m not sure about this. However, I decided to test the hypothesis by writing an AppleScript that logs into my EC2 server, attaches to each screen
session, detaches and closes the connection.
Extracting mp3 file from web page with Python and ApplesScript
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. Keep them there for a few minutes until I’m done working with them, then import the file to DEVONthink Pro Office, tag the file there and delete the original.