I've have used Keyboard Maestro for around six weeks and became a registered user after just week of trialling. The "About Keyboard Maestro" states that I've already saved 62 days - I'm not sure how it calculates that figure, but I won't argue!
Anyway, the point of me posting this is that the equally brilliant KMFAM has started giving an error message when running the "[KMFAM] Add Action(s)" macro despite using it without issues with numerous successes over the past few weeks.
Environment:
Keyboard Maestro v.9.2
KMFAM v.1.1
Mac Mini (M1) Big Sur v.11.4
After highlighting the desired action and issuing ⌘F15 I confirm that the Action name is copied to the clipboard. This is followed by an almighty pause (around three seconds in duration), and the following message is displayed instead of the usual "Add Action" prompt
...This one during normal operation...
The KMFAM configuration is correct. I can see the necessary files via Finder and I can cat the contents via Terminal. The "Add Macro" action works as expected. Other KM macros work as expected.
Stepping through the actions of "Add Actions(s)" I eventually ended up loading "Favorite Actions Core.scpt" into the Safari Web Inspector debugger. I had never used the debugger before this. I hadn't even taken any notice of Javascript for Automation until then. I live a sheltered life. Anyway three days later I now get the following message, but only when using the debugger.
...This one when debugging with Safari Web Inspector
In the debugger itself, the issue occurs with 'getNewActionFromClipboard' with super sexy screenshot and undesirable undefines
At this point KMFAM removal and reinstallation gave the same results. I also relocated the KM Resources Folder to a volume/folder that was not part of my iCloud configuration. Eventually I started with a fresh Each change gave the same errors.
The function 'getActionClipboardType' gives no errors...
I've gotten into the habit of creating macros that perform their own "housekeeping" Nevertheless, I gave the KM Variable List macro a run along with the Clean Up macro....
Before Clean Up...
After Clean Up...
With only those variables in the list, KMFAM still reports the same error
I installed KM on a MacBook Pro (Big Sur v.11.1) along with KMFAM and everything works as expected. Looking through my recent software updates I see that the OS was updated a few days ago which coincides with when I first noticed the KMFAM issue.
Could this update have broken something within KMFAM?
#2 & #3 - Copy these two actions from the DEBUG CODE macro, and paste them here.
#4 - Disable the last "if" in the macro.
Assuming I explained things well enough, and you followed instructions, run it and it should display a window with debug text in it. Post the text here.
You can switch from the debug version to the original version just by enabling and disabling #1 and #2. You can leave #3 & #4 as they are.
Then delete the current contents of the "Execute JavaScript for Automation" action (I think you know which action I mean), and paste the new text into it.
As advised I deleted the contents of my latest arch-nemesis, "Execute Javascript for Automation" action and replaced it with the code from the zipped file..
Here are the results
....and...
DEBUG LOG:
-------------
```
ENTER: Request: getNewActionFromClipboard
ENTER: getNewActionFromClipboard
getActionsClipboardType: com.stairways.keyboardmaestro.actionarray
ENTER: getClipboardStringForType "com.stairways.keyboardmaestro.actionarray"
Clipboard contains type
Result from NSPasteboard.generalPasteboard.stringForType(com.stairways.keyboardmaestro.actionarray):
EXIT: getClipboardStringForType "com.stairways.keyboardmaestro.actionarray"
EXIT: getNewActionFromClipboard
EXIT: Request: getNewActionFromClipboard
Well, at least we know where the error is. I'm getting an empty string from the clipboard. There's two possibilities that I can think of:
The first, and least likely, is that even though the clipboard contains the proper type, it's empty. That seems highly unlikely.
The second and most likely is that for some reason it won't let me get the actual contents of the clipboard. And that sounds very much like a permissions error.
Grasping at straws here, but @ccstone, @JMichaelTX , @ComplexPoint , @peternlewis - do any of you have any idea why I can't get the contents of the clipboard? This code is for KMFAM, which works on just about everybody else's computers, so there's definitely something wonky here.
I think my first step would be to check exactly what seems to be in the clipboard, and under what type key(s), perhaps trying something along these lines:
Here is the output from @ComplexPoint's Clipboard Viewer macro taken after running "[KMFAM] Add Action(s)" (and while the error message and the debug log were still present on screen)
{
"public.utf8-plain-text as propertyList": "Group-L1",
"public.utf8-plain-text as string": "Group-L1\n",
"public.utf8-plain-text as data": "Group-L1\n",
"com.stairways.keyboardmaestro.actionarray as propertyList": [
{
"MacroActionType": "Group",
"TimeOutAbortsMacro": true,
"ActionColor": "Purple",
"ActionName": "Group-L1",
"Actions": []
}
]
}
@ComplexPoint - Can you explain this code in more detail - perhaps break it apart into separate statements? Because whatever you're doing, it works where mine doesn't: