
In fact, I used a variation of this macro when working on my thesis. This technique can easily be replicated in other applications. You can import it into Keyboard Maestro either by double-clicking on the file (it may not work if Keyboard Maestro Editor is not already running), or by using the File » Import Macros… menu inside the Keyboard Maestro app. To use one of the macros, select which one you want from these two options:ĭownload the file (control-click the link) and make sure that the filename ends with. I refer to this as the “polite” version of the macro since it refuses to interrupt you, even for your own good. Note that the actual condition for the front window title is actually written as untitled text.* which will match untitled text as well as untitled text 2 and so forth, which is how BBEdit names unsaved files. However, if you prefer not to be interrupted and to only have files auto-saved after you have named them, you can simply add another condition to Keyboard Maestro, telling it not to save if the title of the front window starts with the words “untitled text” as shown here: This might cause an interruption when you are creating a new file, which might be annoying, but less so than losing unsaved data. If the file has not already been named, this will bring up the “Save As” dialog box.You could also tell Keyboard Maestro to select the menu item File » Save but I prefer the keyboard shortcut.If both of those conditions are met, then the keyboard command ⌘ + S is given which will cause the document to be saved. If you save when that dialog box is open, you will get a saved file with a name like “Untitled.txt” which I find far too annoying to allow. The first should seem obvious, but the second might not: the Save button only appears when the “Save As” dialog box is open, usually when a file has not been named. There is no Button with the name “Save”.The bottom part checks for additional conditions:


In order to avoid any risk of lost data, I use a Keyboard Maestro macro with BBEdit, which I will first show, and then explain: BBEdit includes an “auto-save” function, but it is intended primarily as “crash recovery” rather than the equivalent of pressing ⌘ + S every X minutes.
