

- #Applescript script keyboard maestro how to#
- #Applescript script keyboard maestro code#
- #Applescript script keyboard maestro series#
- #Applescript script keyboard maestro free#

To follow this tutorial you’ll need to be pretty familiar with Keyboard Maestro. I’m also going to touch on using Keyboard Maestro to execute AppleScript actions. In this tutorial I’ll build on the features I’ve already covered and create a powerful macro using variables.
#Applescript script keyboard maestro how to#
In the four previous tutorials, I’ve introduced Keyboard Maestro, covered how to launch apps intelligently, use situational triggers and use control flow actions.
#Applescript script keyboard maestro series#
With it, you string series of triggers and actions together to create macros that give you near total control over OS X. Will create a New Macro Group to be used only within Mail.At this point in the series you should be pretty familiar with Keyboard Maestro it’s one of the most versatile and powerful Mac apps available. Set theMacroGroup to macro group theMacroGroupName If macro group theMacroGroupName exists then Creates a Macro Group if there isn`t one named as intended. Will use the Keyboard Maestro Editor NOT the Engine Set theMacroName to "Move to " & eachAccount & " - " & theMailbox Repeat with theMailbox in selectedMailboxes Loops the selected Mailboxes to create their corresponding Macros on Keyboard Maestro This if statement to allow for no selection to be passed via the Cancel button Set selectedMailboxes to choose from list mailboxList with title ("Pick the desired mailboxes from " & eachAccount) with multiple selections allowed Chooses desired Mailboxes from that list Set the end of mailboxList to (name of eachMailbox) Repeat with eachMailbox in accountMailboxes Set accountMailboxes to every mailbox of thisAccount Fetches the names for account mailboxes (folders) to create a list Set thisAccount to account named eachAccount Repeat with eachAccount in selecterAccounts Set selecterAccounts to choose from list accountList with title ("Pick the desired accounts") with multiple selections allowed Chooses desired Accounts from accountlist

Set the end of accountList to (name of eachAccount) Here's the XML for using ⌃M as a trigger for this macro It's easier to copy and paste its contents from a example in Keyboard Maestro Editor window and its menu (Edit > Copy as > Copy as XML) Keyboard Maestro sets the contents of its items properties via xml dictionaries. # The Keyboard Maestro Macro Group Name (will be created if there is no such group yet). Creates the corresponding set of Macros for Keyboard Maestro Asks for user selection of desired mailboxes on that listĢ.3. Creates a list of every mailbox on that accountĢ.2. Gets the list of Accounts in Mail.App and asks to point which ones should be scannedĢ.1. Use AppleScript version "2.4" - Yosemite (10.10) or laterġ. UPDATED: Added a step to select the desired accounts, to work around issue raised by bellow - Based on idea]() of using the `⌃M` shortkey to trigger a Conflict Pallete on Keyboard Maestro that will filter Macros to Move Messages to specific folders on macOS Mail.app
#Applescript script keyboard maestro free#
Hope it can help someone as well and, please, feel free to improve on it.
#Applescript script keyboard maestro code#
I’m sure there are many ways that this code coud be better more efficient, but hey… I’m not a dev myself and it worked fine for me. It will fetch a list of the folders (mailboxes in Mail parlance) for each of your Mail.app accounts and ask for which ones you would like to create Macros for. (It would probably be easier to create them manually instead of figuring out the code, but what’s the fun in that?) So I’ve hacked my way with AppleScript to automate the creation of these macros. But the prospect of creating and changing each rule to be somewhat tedious. ’s idea of using the same “Move” shortcut ( ^M) combined with a Keyboard Maestro Pallete is really something.
