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. But System Events rules all.
When Anki launches it offers a dialog box with profiles to sync (assuming you have multiple profiles.) Using AppleScript and System Events scripting, you can drive the keyboard as it manipulates the PyQt interface. Here’s my solution. Yours may vary depending on where the profile in question lies in the list.
tell application "Anki" to launch
Much less painless than Automator.