Scripting vs Other Automation Tools (like Keyboard Maestro)


(Jim Underwood) #1

Scripting vs Other Automation Tools (like Keyboard Maestro)

We had a good discussion of this in the Keyboard Maestro Forum, so I thought I’d share this with you guys.

See my post: Keyboard Maestro vs Scripting

You might be interested to know that a number of very skilled scripting developers, like Chris Stone (@ccstone), are also heavy users of KM. I have found using both to make my automation tasks much easier and faster.

Just moved this from my topic on How Do I Get/Set Mouse Position?

For everyone’s benefit, Keyboard Maestro has a ton of very easy to use UI Actions/Token/Functions that cover screens, windows, menus, mouse, buttons, and more.

In general, I find it much easier to automate many of my Mac workflows using KM than I do AppleScript. But, when I need AppleScript (or any one of several other scripting languages), KM provides an “Execute Script” action that works very well, with very little overhead.

If you’re interested, take a look at these KM Wiki articles:

We actually have a lot of scripting discussions in the KM Forum. Please drop by to browse and/or contribute any time you’d like. You might be particularly interested in KM Forum topics tagged with:

See all tags here.

I encourage all to participate in this discussion, and share your experiences, preferences, questions.


How Do I Get/Set Mouse Position?
(Jim Underwood) #2

Using KM from AppleScript

I just wanted to mention that you can take advantage of KM from AppleScript, so it becomes like a script library, although it is an app. For example, from AppleScript you can:

  • Execute a KM macro
  • Process a KM token to get a wide variety of information easily.
    • For example, I can’t get mouse position in AppleScript, but I can easily get it with this KM token:
      • tell application "Keyboard Maestro Engine" to set mousePosStr to process tokens "%CurrentMouse%"
  • Use the large array of KM functions using the KME calculate command.
  • Dynamically create/execute a KM Macro and Actions
  • Take advantage of the KM HTML Prompt,
    • which is just a web page with KM hooks that does not need a web server.
    • Can be as complex as any web page, including the use of JavaScript.
  • Get, Set, Create, Delete any KM variable.
  • and more. . .