KM Sometimes Does and Doesn't Work With MacOS Pages

I have a shell script that goes through a list of files, opens them in Pages and edits them.

Often the KM macro will fail, particularly at the end when exporting to a PDF

I assume KM does some cooperative scheduling with MacOS and Pages.

Would longer pauses in either KM Macro or in Shell help? What is KM or MacOS doing?

If I do each document bu manually executing the macro each time, it works, but adding longer delays in the shell script between calls doesn't seem to do much.

Hey there, I moved your post to the Questions and Suggestions category since it’s more suited for it.

It also might be helpful to post your actual macro so we can see what might be going on with it.

When you execute the process manually you aren't just mindlessly pausing a certain about of beats between steps. You are waiting for a certain condition before proceeding.

You can do that in Keyboard Maestro with the Pause Until action, for example, which has a number of conditions to choose from. That might be more effective that a blind pause.