Macro Misbehaves Due to AntiVirus System

I have a Macro that Chris Stone (HERO!) helped me with a little more than year ago.

It just resizes images to a specific size. It has worked for over a year on 3 machines I use, but recently it stopped working on just 1 of my computers. I have tried to rebuild it from scratch but it just won't seem to budge.

Its not working on my Mac Pro Running Mojave but works on 2 MacBook pros running Catalina.

Any reason why its not seeing any files selected in finder or tweeks I can make?

Well a computer reset seems to fix it. Just strange it stops working so often.

If it still stops working so often:

Can you upload the macro? This would make it possible for other users to test your macro. (I don’t have a Mojave OS running, but others might.)

Is there any error notification? What do you see in the KM Engine log?

I have never even looked in the Error log great place to start. I dont think this issue is isolated to this macro as I have another Macro for iTunes which simply just selects a menu item and clicks ti and that gets this error
Can’t make alias "/Users/brianamartin/Library/iTunes/Scripts/Multi-Item Edit.app/Contents/Resources/mainMenu.scpt" into type file.

So when the Finders resize doesn't work neither does that iTunes one. And I am sure others error out. Seems like its something in my OS or keyboard maestro itself.

I have attach both macros but I am going to dig into the error logs now and see if that helps.

Finder Resize.kmmacros (26.4 KB)

05)Multi-Item Edit Macro.kmmacros (51.1 KB)

I think I am going to try and reinstall KM incase the issue is something as simple as that.

Your Image Resize macro:

It works here, that is, it applies the size modifications to a Finder-selected image file and writes back JPEG data.

But it has some issues:

  • Check your macro, it seems you are applying the same actions twice to the same target file.
  • The macro writes JPEG data, but it writes it back to the source path. So, when I run the macro on a PNG I get a JPEG with a .png extension. You should use the correct extension when writing it back.

Your Music.app macro:

Couldn’t test it because I don’t have a “Scripts” menu in the Music.app. How do you create this menu?

Is it possible that your macro was written for iTunes, and the group automatically changed to Music when I imported it (no more iTunes.app on Catalina)?

Thanks for taking a look. So for some reason that macro has only ever worked if it does the steps twice. and I Realize that when that macro isn't working I am getting those issues in iTunes (I am using the iTunes app not music)

So when that iTunes macro does work None of the macros work in iTunes and some execute scripts the are in the macro itself. It seems like this issue is related to something wrong in my OS with permissions or something and I am not sure its KM issue. I've gone 4 days with no issues so Hopefully this keeps up.

Well, in each part of the macro you had 2× Resize Image to 600×600 and 1× Resize Image to Fit 600×600, so you are resizing the image 6 times (!), and writing it 2 times as JPEG.

(You are aware that JPEG is a lossy compression, right? With each compression run you loose quality.)

I threw out all the duplicate actions, and it still works here.

Besides the literal duplicate actions, what is the point in combining a Resize Image with a Resize Image to Fit action (with the same dimensions)?

Indeed, when several (or maybe all?) macros stop working at the same time, then most likely KM Engine has some fundamental problems to do its job.

I tend to think this too. You could create a fresh user account, and see if the issues happen there, too. But since it seems to be intermittent, this can become time consuming.

There is a troubleshooting post about permissions, in case you haven’t seen it yet:

1 Like

Thank you for this Tip. I really just use this to size TV artwork for iTunes so it being JPEG is totally fine. But for some reason I need it to run all actions twice for it to work.

This is great!

Out of curiosity: How old was the OS? (Since the last “clean” install.)

I spoke too soon I am having the issues again.

I was using Mojove but I did a clean install about 1 month ago.

What can I run in KM to see the log and maybe ID the issue?

Then the OS really should be fine. (Unless you install lots of weird stuff in the form of drivers, kernel extensions, low-level background processes, …).

Was this still the case even during the week when everything worked fine?

As mentioned, on my computer the macro runs fine without all the duplicate actions. I would start investigating there. Try to find out which type of actions require to be executed twice (Only image-related actions? Only Finder-related actions? Any action?)

Where can I pull the log for KM Engine to see what is causing this error before I re-start my computer and it starts working again?

It always seemed to be related to that action in Finder, but always worked in my Path Finder group. I will try to move the macro out of the finder group and see if it works globally without the duplicates after I restart the comp

Here are the errors in the log:

2020-02-20 09:00:22 Execute macro “16)Resize JPEG Images (Mac Pro)” from trigger The Hot Key ⌃⌘I is pressed
2020-02-20 09:00:22 Async NSAppleScript error 2020-02-20 09:00:22.276 CompileAppleScript[78833:9688664] Keyboard Maestro Internal AppleScript Execute Error: Finder got an error: Can’t get alias "/FILE NAME".

The error message here is about ALIAS.

2020-02-20 09:00:29 Execute macro “05)Multi-Item Edit” from trigger The Hot Key ⌘M is pressed

The Error message I get from the App is also about an ALIAS.,

Seems you have found the log.

Indeed, similar as with your iTunes macro above. Probably @peternlewis can help here.

The tips from Peter’s Permission Issues post I linked above didn’t help, right?

In the post you deleted you said you didn’t see the issues for one week after the fresh OS install. If this was true (the one week without issues), then try to remember what you did after that week. What did you change/install? (Especially things like mentioned here.)

I didn't look yet because my logic was if it works 90% of the time why would permissions change randomly. I was thinking it was related to the computer going to sleep but it appears to be related to when I edit macros on this machine than I need a re-start and I get this ALIAS issue.

So I haven't touched this machine once, The Marcos were working until I went to edit the Macro in the Finder group. I haven't installed or updated any software or updated any apps over the last week, ;ll go through that link now

Actually the post is pretty much exactly about that:

[…] so anyone would assume that means they have permission, but the system is actually lying, and you have to toggle the checkboxes off and on again to grant permission - who would even think to try that?

So, maybe it’s worth to read it. I don’t think that is related, but who knows. You always want to exclude the more common potential causes first.

Good idea. Next time I see the issue I will try toggling and see what that change. For now I have re-started the comp so I can use everything.

Going to look into that Finder resize image issue right now.

Yes, and consider reading the rest of the post too.

What I would also look at, is the system log. Maybe it gives some additional clues that are not in the KM Engine log, e.g. other strange things that happen around the same time when your macros start to fail.

(The Console app window may look different with Mojave.)