KMFAM odd behaviour

I've been using KMFAM very happily for a while and never had a problem until today.

When trying to use it to add one of my favourites to a macro I'm developing, nothing actually gets added and the macro remains unchanged.

Looking in the KM log I see this:

2020-10-09 14:39:55 Execute an AppleScript failed with script error: text-script:72:79: execution error: System Events got an error: Can’t get window "Keyboard Maestro Editor" of process "Keyboard Maestro". (-1728)

Anyone have any ideas what may be happening (especially @DanThomas)?

Never seen that error before. Have you tried rebooting?

Thanks, Dan. I'll try that later tonight and update you then.

EDIT: I just had a thought. Tried tried doing the same thing again, but on a much shorter macro and it worked with no issue.

The macro for which it didn't work was this one: Pages with LaTeX.kmmacros (34.2 KB)

which I've been developing as a response to a query on this forum here: Conversion pages (Mac) from Inline LaTex document using Keyboard Maestro macro

All I do is click on the last group (in magenta) to select it and then initiate KMFAM to insert one of my favourites - an action to play a specific sound. Very rudimentary!

I will try the reboot later and provide an update.

Works for me. Not sure what could be the problem for you.

1 Like

Thanks for trying that out. Out of curiosity I’ve just tried again (I haven’t rebooted yet) and it works OK now but I’m still getting the error in the KM log! Weird. Will try again after reboot which will be tomorrow for me!

Is it possible it's always generated that error, and nobody's noticed?

Never thought of that! Have you checked your log at all?

Never. :joy:

You’re cracking me up here!

I've rebooted now and KMFAM works fine now and I'm not getting the log error either. Must be my Mac asking for more time off!

I've seen Macs do strange things like that before. Which is still a lot better than some of the things I've seen Windows do. :joy:

1 Like

@DanThomas ... first of all, thanks for making an amazing macro. KMFAM has saved me such an incredible amount of time thus far.

For the last couple of months though, I've been having the same issue as tiffle. The KMFAM window launches, but no action is pasted into the macro I'm working on.

After rebooting my computer, the KMFAM macro does successfully paste the selected favorite action once, but it throws an error notification ...

Action Failed - Delete Past Clipboard 0 index out of range in macro "[KMFAM] Select or Switch to Insert Action by Name" (while executing Delete Past Clipboard 0).

After that, KMFAM will paste actions, but always the same one as was selected the first time (where the error came up) regardless of which favorite action is selected.

After restarting Keyboard Maestro (but not rebooting the computer), the issue is the same as described by tiffle ... you select a favorite action, press the "okay" button, you see a brief highlighting of the "Edit" menu item in the Keyboard Maestro window, but no action is pasted.

I attached a copy of the engine log with annotations about what I was doing each step of the way. I'm hoping you might have an idea how I might fix the issue.

Wow, you did a lot of research! Unfortunately, it doesn't help me much.

Thinking out loud:

The fact you get an error when it tries to delete the past clipboard entry bothers me. This shouldn't happen. Do you have another application or utility that also manages the clipboard?

I have no idea why it would fail trying to locate the editor. That makes no sense at all.

Here's some obvious things, which probably won't help, but it's good to be thorough:

  1. If you check KM>Preferences>Excluded, is it possible you have KM in the Clipboard History exclusion?

image


  1. When you insert a favorite action, are you sure you have something selected in the editor? Either selecting the "No Action" placeholder:

image

or an existing action:

image


  1. Are you sure you're in Edit mode?

image


When you ask "Do you have another application or utility that also manages the clipboard?" Are you talking about the system clipboard or specifically the KM clipboards? I do have both Launchbar and Alfred quick launch apps installed that do have some control over the system clipboard. At some point I also had "Paste" and "Copied" apps installed that were OSX clipboard manager apps, but both have been uninstalled for a while.

  1. I don't have any applications listed in the Clipboard History Exclusion section,
  2. yes, I always have either an existing action or the "No Action" placeholder selected in the editor when I run KMFAM,
  3. and I am in "Edit" mode.

Currently, I am using KM on two computers and syncing over Dropbox. The KMFAM resources files are also located on Dropbox. Not sure if that could be contributing the problem.

I checked the other computer, and it is doing the same thing with the same error messages.

I also thought maybe another KM macro was interfering with things, so I disabled everything other than KMFAM and a test macro for adding actions and still had the same issue.

I'm thinking maybe the next step is to just reinstall KMFAM and see if that makes a difference. Should I just delete the KMFAM macro group in KM and reinstall using the KMFAM Macros Installer.v1.1? I'm guessing that all my favorite actions are stored in the KMFAM resources folder and won't be affected by deleting and reinstalling the KMFAM macro?

It shouldn't be a problem sharing the resources - several people I know of are doing it with no problems.

Reinstalling seems like a reasonable next step.

  1. Yes, delete the existing KMFAM macros and group.

  2. Rename the existing Resources folder.

  3. Reinstall KMFAM and test it out, to see if this solves the problem.

Regardless of whether it solves the problems or not, here's how you restore your current KMFAM macros:

Inside your original Resources folder, it should look something like this:

image

The folder under the prefs folder might have a different name - the part I've highlighted in blue may be different, I can't remember.

Regardless, the files I've marked in yellow are your preferences. Replace the ones in your new Resources folder with the ones from your old Resources folder, and you should be good to go.

Good luck, and let me know what happens.

I'm having some issues with the re-installation ...

I deleted the KMFAM macros and group and downloaded the "KMFAM Macros Installer.v1.1.zip". When I run the installer, I get this error message after clicking "Install".

If I then try to run the installer again, it prompts me to "Please locate the file 'KMFAM Macro Installer.app'" after clicking "I agree."

Disregard the last post ... I could now get KMFAM re-installed.

I tried on my other computer. This time I didn't get the error message (maybe because I left KM running this time as opposed to quitting the application before installation as I did the last times). I did get the same "please locate the file KMFAM Macro Installer.app," but I just selected the same installer that I had just run (and that gave me the 'please locate' message), and it worked. Sort of weird, but it installed just fine.

Will post again shortly whether the re-installation fixed my issue ... just didn't want you troubleshooting something I already got figured out.

I didn't substitute my old preferences into the resources' folder yet to eliminate the possibility that something there is the issue.

After a computer reboot and starting KM, I had the same errors/issues as before. Oddly enough, after restarting KM (without a computer reboot) it kind of worked and was pasting the right actions. But, at the same time, it was also still throwing "Action Failed - Delete Past Clipboard 0 index out of range in macro" errors.

I restarted the computer to see if I could recreate the situation where it would work after a KM reboot, but its back to either not pasting anything or pasting the wrong (past selection) action.

At this point, I'm thinking about maybe doing a clean KM and KMFAM install to see if that works on my computer. Because I'm having problems on both my computers, I'm guessing that there is an issue with something being synced by KM. Would be interesting to see if KMFAM works after a clean install and breaks after starting syncing again.

Other than that, I'm wondering if my computers might be too slow to process something and the KMFAM needs a pause to prevent the macro from getting ahead of itself. I've had the issue with the action not pasting for several months and I remember having occasional success with repeatedly trying to paste the macro (at the time, I was thinking that maybe there just needed to be a little pause set in the code before the action gets pasted because the macro was getting ahead of itself). It's probably not that, but I thought I would mention it since that was my thinking before.

Thanks again for trying to help solve the problem. If you have anything else I could try, I'm happy to put in time troubleshooting as best I can.

I solved the issue. I ran the following variable clean-up macro...

https://forum.keyboardmaestro.com/t/clean-up-delete-km-variables-km8/10673

... and afterwards KMFAM works great again. Before running the macro, I backed up my KM Variable DB and realized that the total size of my variables was about 30mb. With all the "excluded from environment to ensure the environment is not too large" engine log messages, I'm thinking that maybe the large number of variables was causing a delay and the KMFAM macro got ahead of itself somehow. Or maybe there was some issue with a specific variable that went away after the clean.

Nevertheless, it’s working again. @DanThomas thanks for your help!!

2 Likes

That's great work! And that makes sense, about the environment size. Glad you worked it out!!