Last active
March 9, 2024 06:03
-
-
Save carlsmith/bc699f02e1b25513fc8dde5bb74106ca to your computer and use it in GitHub Desktop.
IPython line magic for running a Keyboard Maestro macro by name.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
from IPython.core.magic import register_line_magic as line_magic | |
@line_magic | |
def maestro(name): | |
quote = lambda text: '"{}"'.format(text) | |
command = " osascript -e 'tell application {0} to do script {1}' " | |
os.system(command.format(quote("Keyboard Maestro Engine"), quote(name))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment