I made a macro requiring over 300 steps and it WORKS! Here's what I learned

It's a Wordpress post uploader that pulls article + images from a folder, fills in all the Yoast plugin steps, debugs the facebook image, pulls the posting date from a database of randomized dates, publishes the post, saves the URL to a text file and then goes on to the next one in the folder! Can batch upload any number of WP posts now so long as all the components are put together properly.

Pulling all the components from the folder uses found images and strict naming practices - for example all the articles have - ARTICLE.txt appended to the file name, and so I screenshot that part and then it can always find the article within a folder, open it, select all, copy, close, switch app, paste.

This macro literally saves DAYS of work when uploading a batch of 1000+ posts to a blog.

I was amazed that I managed to get it to do all the things required to upload a post and I had to use every bit of skill I had to make it work, as well as come up with some novel hacks to make certain tasks work.

Top things I learned:

  1. Most of the times macros break is because of insufficient time gaps between the steps. I always put a wait in between every single step - but every so often OSX will just lag and break the macro. Increasing the size of the pauses between steps makes the loop take longer but makes all macros more robust, which in the end saves more time. Make the macro ultra robust and then move to another computer to do something else.

  2. the second most common cause of KM macro breakage is not being able to locate "found images". Sometimes it just fails, even if nothing has moved and it found it 20 times in a row previously.

  3. FEATURE REQUEST: When dragging an image into the "found image" step - the window (highlighted) displaying the image that has been dragged in, is so microscopic that it quickly becomes impossible to see which image that step is referring to. Increasing the size of this completely useless micro-thumbnail would be super helpful!

Screen Shot 2024-07-08 at 6.55.10 PM

  1. Theres an old saying that any big task can be achieved if broken into smaller bite sized tasks. The same applies to macros. Figure out the steps one at a time as separate macros, trigger them manually in order to fine tune - and then chain them together / loop them.

Tip: click the "image well" as they call it and then press your space bar and the image will be shown at a useful size!

Thanks for sharing your experience!


Aha!!! many thanks!

1 Like

You don't mention it but the ability to rename actions so at a glance it's more readily obvious at a glance what they're doing is very useful.

For example, an action using a "minuscule"-looking image could be renamed something like "Click on PDF Option Radio Button" which might obviate the need to see what's in the image well.



Congrats, that's a beast of a macro!

If that's part of the 300 steps, and it really is between every single step, you can greatly simplify it with this action as your first in the macro:

Then you just have to change the value in one location to change all the delays. The downside is that this is between every action, so the effect compounds itself quite quickly. You could also sprinkle these throughout the macro, changing delays where necessary, which is still probably quicker than separate delay steps.



hey thanks, that's interesting. Yes I put a delay between every step in order to limit breakage - all the time delays are of different length however, depending on the anticipated lag. Some delays 0.1 secs, some several seconds - if I set them all to several seconds it would become chronically slow.

Hey, @ROOK, welcome to the forum and thanks for sharing your experience!

Another thing to consider is the Pause Until action. With it, you can often wait the sufficient time, but no longer than necessary.


thanks! I have used pause until in very basic ways i.e. "activate finder --> pause until finder is at the front" sometimes, but seems there's a lot more potential to explore here.

1 Like

Congratulations! Now to make use of those saved days, coz a big macro is never finished :wink:

Have a look for places where you can change these hard-coded pauses to state-dependent ones. Making your macro "Pause until..." a button is enabled, a progress bar disappears, on OCR condition is met, and so on will not only make your macro more robust -- it can also speed it up by reducing overly-cautious pauses.

Web pages can be surprisingly inconsistent with image rendering (whatever the cause of that may be!). You can improve detection by increasing the "fuzz", reducing the area to search to remove false positives, and maybe swapping from "Best" to one of the other options (depending on where those false positives are cropping up). When your window is a known size, most interface elements are in a fixed position either relative to the window edges or a more easily image-detectable element -- base your search areas on those points by using the "in area" option -- you can use calculations in the co-ordinates fields.

Very, very, this. And it sounds like you've done a great job putting theory into practice!

1 Like

many thanks, yes I really need to level up in this area.

not always with web pages, in fact more unreliable is finder windows; I find that it will sometimes just not find the image at all, no matter the fuzziness, and then grabbing the window and moving it a bit then trying again it finds it.

Very interesting - the items being located are files within a folder that have unique names, and therefore not fixed positioning within the window, so I added categorization in order to be able to always locate them. Agree in principle - sometimes I will start a macro with resizing the window so that known elements are in the same place. Was not even aware that you could search for an image within a certain area, I've been running my searches in the entire screen or even 'all screens'!

Is this for drag'n'drop file uploading? If so, look to use the "Click here to upload..." option -- most front ends have it, and if it doesn't then contact the developer and use the magic phrase "accessibility legislation compliance" :wink:

You'll find it much easier, and much more reliable, to do the uploads by collecting a list of file paths then, for each path, using a front browser action or "Click at image" on an "Upload" button and putting the path into the standard "Open" dialog -- plenty of examples on the Forum.

1 Like


[...] I put a delay between every step in order to limit breakage - all the time delays are of different length however, depending on the anticipated lag. Some delays 0.1 secs, some several seconds - if I set them all to several seconds it would become chronically slow.

You may have already realized this, but I suppose you could set a short default pause and add exceptional longer pauses where needed. I wasn't aware of the Set Between Actions Delay action and will try using it myself.

Congratulations on your long time-saving macro. I know how you feel, as I automated the production of my organization's annual yearbook when I was working. That was a real "beast", with a lot of complications. They kept using my automated procedure for a couple of years after I retired, but then presumably tried to get away from the Mac, couldn't do it anymore and presently aren't publishing a yearbook at all.

1 Like

thanks, yes it is for drag and drop - but it is going through hundreds of folders, pulling the image, doing the other steps and then moving on to the next folder. So the file path is different every time, I found it easier to name all the images for example with the suffix WP.jpg and then screenshot that part, so that it can grab it from the folder via click and hold, change apps and then drop in the right place in the window.

Nothing in that would seem to preclude the use of paths and the more robust path-based KM actions that would enable -- but stick with what's working for you. Just hope that the next OS update doesn't change the system font enough to break things!

Here's my contribution based on what I learned and applied for the last 2 years of working with KM:

1 - I follow a very intuitive color scheme for my actions, which makes it super easy to understand when I look at it (maybe some of you who have seen my shared macros may think it's too much, but to me it just makes everything faster and easier):

  • Actions that require a stop such as "Pause Until", "Alert", "Prompt for User Input", etc, are colored red.
  • All the other actions are green, because they are just running without stopping.
  • All the conditional actions (or loops) are yellow such as "Switch", "If Then", etc.
  • Any action that is related to setting/changing a variable are purple, just because it is the color I associate with the purple X icon that's set as the default for the variable actions
  • The comments are teal and the groups are pink/magenta, for no particular reason.

So that gives me a quick hint of what my macro contains, where my variables are, etc. And when I want a certain action to grab my attention, I just leave it without a color. Usually it's a macro that I need to fix or something.

2 - I worked on a macro for 2 days recently and from my basic understanding of AppleScript (with a lot of help from Claude.ai) I'm starting to think that whenever possible, using AppleScript to find a button, for example, seems more reliable than using a Found Image or using the default "if found button..." option. This macro I was working on, didn't cause any trouble with the AppleScript actions I used, but did with the other options.

3 - Save as many favorite actions (and groups of actions) as possible, with the most common settings, with the colors you're using (if any), etc. That will save you so much time. Use extra actions with comments if needed, or add the comments to the actions themselves, for example in Execute Script actions to remind you that "XYZ is done this or that way". Things just flow so much faster.
Still related to the favorites, add "codes" for certain actions/groups of actions, instead of setting names that are "exact" and "pretty". For example all my favorites start with = so when I type = all my custom actions are visible. For my Execute AppleScript, the name I gave it is =as (as for "AppleScript")

For new variables, even though I have the "right" name in the beginning, I have my own "code" new var which is what I type to insert a new variable. And you can see that it is already purple and since I use Local variables 99.999995 of the time, it's already set to that

4 - Create snippets for things you use regularly. For me, for example, is to add variables. When I copy a variable, for example "Local__databaseText", I then type %paste and it will automatically create %Variable%Local__databaseText%.
It's just easy for me to remember the % and then paste, because that's the action I need.

So yeah these are the most important things I learned that really sped up my workflow.


I also use variables for my pause times sometimes, and then I can tweak them as necessary to find a happy medium between speed and robustness.

e.g. local_shortPause = .2s, local_longPause = 1s

Then adjust as needed. When I'm doing troubleshooting and need to slow things down to see what's going on, it's pretty easy to make changes, then change it back.

Congrats, @ROOK! This is the power of KM. Feels pretty great to make your Mac work this hard for you, yeah?

Can't emphasize this enough: Have a good look at all of KM's Pause options. Pause Until is DEEP. In fact, I teach two KM classes on Skillshare – a Getting Started class, and a class devoted to Pauses. They're that important.

Also, now that you have all that time on your hands, learn about XPaths if you haven't already. They revolutionized all of my Web-centric KM macros.

Cheers and congrats again!

1 Like

Same, yep! Very useful.

1 Like