Applescript
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. Here’s what I do to wake the computer up at specific times so that scheduled AppleScripts can run:
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. But System Events rules all.
Collapsing DEVONthink groups via AppleScript
I’ve been moving to a tag-based system for organizing content in DEVONthink. All of my content for each database goes into a single group called “reference.” If I want to find something, I search the hierarchical tag structure instead of diving into some arbitrary list of groups.
But I still have groups that I’d like to collapse into the reference group. So I wrote an AppleScript to perform this action. Notably, most of the action is in the processGroup()
handler which is recursive because we do not know how deep the group hierarchy goes.
Working with DEVONthink Pro Office and Hazel
My main organizational tool DEVONthink Pro Office, a tool I’ve used for many years. I’ve written previously about it and how I use it to find things and how I synchronize databases across machines.
I’m a relative newcomer to Hazel though. Hazel’s tagline is “automated organization for your Mac.” Hazel works as an agent to keep folders organized on the Mac. It’s an engine that applies per-folder rules to take actions on files and folders. Actions can include tagging files, moving them to other folders, running AppleScripts, deleting them, etc.