Problems with KMFAM Macro System

@peternlewis - A couple of questions.

  1. I think the answer to this first question is "no", but I had to ask: Is there another way to initiate "Copy as XML" for the selected actions, other than using the menu item? Perhaps something using AppleScript/JXA?

  2. Assuming the answer to #1 is "no": Let's say I have someone import a .kmmacros file, and one of the macros has this action:

image

This specifically mentions a menu in the Keyboard Maestro application. What if they have a different version of Keyboard Maestro? Will this action automatically use their version of Keyboard Maestro? (I mean, assuming they have a version that has "Copy as XML".)

Would it be better to change this to "Front Application"? I can be pretty sure KM actually is the front application, by the way.

Thanks.

Sure! Let’s do it!

@hello - Thanks! Let's see how this works for you. If you have suggestions that will make it easier, let me know.

Download and unzip this file, and follow the instructions in the README file:

KMFAM Updated Macros for v1.2.zip (41.0 KB)

Let me know. Thanks again.

1 Like

Steps worked great, now I get it why this macro has been a favorite,
Thanks Dan!

As a new user of KMFAM, I added some additional wording and icons to some macros, to more easily differentiate what they do:

01)[KMFAM] πŸš€ Select (USE THIS ONE to insert stuff)
05)[KMFAM] Add Action(s) - Adds new action, or overwrites existing action

β €β €β €β €β €β €


Edit: After trying it, KMFAM partially works,
It's fine, I wouldn't devote any additional work on your part, I mostly use Actions so this is not important.

What works: Adding and inserting Action works, which is great, since this is the most useful feature for me.
What doesn't work: Macros don't get displayed in the Select list.

Adding actions using 05)[KMFAM] Select works fine, but something between 03)[KMFAM] Add Macro or 05)[KMFAM] Select doesn't seem to work.
Gets added to the list, but don't appear in the list.

:smile:

Oh joy, more debugging. :joy:

In the KMFAM Resources folder (wherever you put it and whatever you named it - if you can't remember, look at this variable: DND__kmfamResourcesFolderPath), there's a file named "FavoriteActions.json":

image

Can you zip "FavoriteActions.json" and post it here in a reply? I'll take a look at it and see if I can spot anything.

1 Like

zip file:
FavoriteActions.json.zip (1.7 KB)

{
  "id": "FavoriteActionsData",
  "version": "1.0",
  "actions": [
    {
      "uuid": "41D6B087-9FEC-4502-8692-E01BC6F45762",
      "name": "Tutorial Video",
      "script": "9B5DEA2E-919F-4B28-A320-8DDD328C3E2C",
      "type": "macro",
      "imageFileName": "41D6B087-9FEC-4502-8692-E01BC6F45762 1472826817221.jpg"
    },
    {
      "uuid": "67BF55BB-9E5A-42C4-8D0A-F190A3BD6FF9",
      "name": "Set Variable To Text - Delete",
      "keywords": "Delete",
      "script": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<array>\n\t<dict>\n\t\t<key>ActionColor</key>\n\t\t<string>Orange</string>\n\t\t<key>MacroActionType</key>\n\t\t<string>SetVariableToText</string>\n\t\t<key>Text</key>\n\t\t<string>%Delete%</string>\n\t\t<key>Variable</key>\n\t\t<string>VarName</string>\n\t</dict>\n</array>\n</plist>\n",
      "type": "action",
      "imageFileName": "67BF55BB-9E5A-42C4-8D0A-F190A3BD6FF9 1622733387765.jpg"
    },
    {
      "uuid": "BF05F4FC-C638-4B81-8FFE-5B4BB757FCD7",
      "name": "UUID",
      "script": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<array>\n\t<dict>\n\t\t<key>ActionColor</key>\n\t\t<string>Purple</string>\n\t\t<key>ActionName</key>\n\t\t<string>Execute AppleScript to Enable/Disable Selections</string>\n\t\t<key>DisplayKind</key>\n\t\t<string>None</string>\n\t\t<key>HonourFailureSettings</key>\n\t\t<true/>\n\t\t<key>IncludeStdErr</key>\n\t\t<false/>\n\t\t<key>MacroActionType</key>\n\t\t<string>ExecuteAppleScript</string>\n\t\t<key>Path</key>\n\t\t<string></string>\n\t\t<key>Text</key>\n\t\t<string>tell application \"Keyboard Maestro Engine\"\n\tdo script \"xxxxx\"\rend tell</string>\n\t\t<key>TimeOutAbortsMacro</key>\n\t\t<true/>\n\t\t<key>TrimResults</key>\n\t\t<true/>\n\t\t<key>TrimResultsNew</key>\n\t\t<true/>\n\t\t<key>UseText</key>\n\t\t<true/>\n\t</dict>\n</array>\n</plist>\n",
      "type": "action",
      "imageFileName": "BF05F4FC-C638-4B81-8FFE-5B4BB757FCD7 1622781891080.jpg"
    },
    {
      "uuid": "D8BCC16C-6771-4813-AFC1-A3A4161C32F2",
      "name": "Comment",
      "script": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<array>\n\t<dict>\n\t\t<key>ActionColor</key>\n\t\t<string>Green</string>\n\t\t<key>MacroActionType</key>\n\t\t<string>Comment</string>\n\t\t<key>StyledText</key>\n\t\t<data>\n\t\tcnRmZAAAAAADAAAAAgAAAAcAAABUWFQucnRmAQAAAC6GAAAAKwAAAAEAAAB+\n\t\tAAAAe1xydGYxXGFuc2lcYW5zaWNwZzEyNTJcY29jb2FydGYxNTA0XGNvY29h\n\t\tc3VicnRmODMwCntcZm9udHRibH0Ke1xjb2xvcnRibDtccmVkMjU1XGdyZWVu\n\t\tMjU1XGJsdWUyNTU7fQp7XCpcZXhwYW5kZWRjb2xvcnRibDs7fQp9AQAAACMA\n\t\tAAABAAAABwAAAFRYVC5ydGYQAAAAlmygWbYBAAAAAAAAAAAAAA==\n\t\t</data>\n\t\t<key>Title</key>\n\t\t<string>Untitled</string>\n\t</dict>\n</array>\n</plist>\n",
      "type": "action",
      "imageFileName": "D8BCC16C-6771-4813-AFC1-A3A4161C32F2 1625423006916.jpg"
    },
    {
      "uuid": "C29457D4-EF7F-48ED-9F8D-BD7EB59DEAFE",
      "name": "πŸ’‘[TIP] - How to delete variable",
      "keywords": "",
      "script": "B27ADDBF-48F8-4A6C-96CD-65419463082F",
      "type": "macro",
      "imageFileName": "C29457D4-EF7F-48ED-9F8D-BD7EB59DEAFE 1625424515819.jpg"
    }
  ]
}

Update:
In the Select window, added a different macro, now:

  • Good: now I can see this macro I just added, but
  • Ungood: When selecting this macro, the macro doesn't get added to a macro group (which is what I would expect to happen, not sure if that's the expected behavior).

Actions have an XML property.

Have the Keyboard Maestro application selected by bundle ID and it should be fine, given Keyboard Maestro editor should already be running anyway.

Front application would be normal in the case where you expect Keyboard Maestro already to be at the front.

Awesome!

Perfect. Thanks!!

Macros don't get added, they get executed. See https://youtu.be/gRYArKTc7eI?t=440 for more information.

So does it look like it's working now? :crossed_fingers:

@peternlewis - In case you wonder what you're missing, check out my YouTube video. https://youtu.be/gRYArKTc7eI. I just rewatched it, and it's pretty good. :grinning_face_with_smiling_eyes:

3 Likes

@peternlewis sherlock this

@peternlewis - I was just bragging about what I've done. I couldn't help it. So just ignore me (not permanently, just on this subject). :grinning_face_with_smiling_eyes:No reply needed.

2 Likes

Lots of people love it. Brag away.

It occurs to me that part of it is that I target Keyboard Maestro at people with less powerful use cases generally than those at the top end on this forum - keep in mind that the folks on this forum are typically the highest end users of Keyboard Maestro. So they tend to ask for high end features that are irrelevant to the vast bulk of Keyboard Maestro users. So perhaps that explains why I do not always implement features even when they are relatively frequently requested on the forum.

2 Likes

Understood, and I totally agree. The most important thing that you, or any of us, could do to promote KM is to make the entry curve as low as possible. Way more important than all of the bells and whistles most of us on this forum squawk about.

:smile:

2 Likes