Maximum number of Actions available within one Macro?

Hi, just wondering if there exists a maximum number of actions in KM, and if so what is that number?

Am asking as am about to create a macro that will require around 500 actions, and wanted to know if this is indeed possible before going to the effort of trying to create it!


I don’t know if there is a max. number of actions. But even if there is, you can always split your macro in two or more macros and execute the next one with the Execute Macro action.

Probably you know that, so just in case: There is a Repeat action that allows you to repeatedly execute actions or whole sequences of actions. Use this instead of multiple instances of the same action or action sequence.

With long and complex macros it is often easier to write them entirely as AppleScript or JXA scripts – if possible. Due to the graphical nature of KM Editor, a long macro can become confusing, especially if it has multiple nesting levels (e.g. If…Then).

Sorry, but that seems excessive to me, but I could be wrong.
Do you mind describing what you are trying to automate/accomplish?

My first reaction was that if you really need something that complex, then likely a script would be a better tool.

You may be right there, I was merely using Actions as I'm no good with coding/scripts.
Basically I am trying to create a slideshow-type thing which displays a series of images in a variety of different pairs e.g. Image 1/image 2; image 2/image 3; image 3/image 1 etc. I am accomplishing this using the split page view feature on Preview in mac; I have set up a macro that opens the PDF in question within Preview then launches another window with a second iteration of the same PDF (using the "print preview" function), then enters split screen view so that both preview windows containing the document are displayed side by side.
My plan was to then create a bunch of additional actions, each of which would show a different pair of images by simulating the keys required to display each pair of images (option command G X [go to page X (containing image X) in first PDF window], command ** [switch to second window], **option command G X** [go to page X (containing image X) in second PDF window], **command [switch back to first window ready for next pair]).
I was going to set these up on a timer so that every X seconds the next Action plays and thus the next pair of images is shown.
Since there are hundreds of possible pairs of images, this would require hundreds of actions (1 for each image pair)...
...unless there is a smarter, less laborious option...?
Also to the original question, out of interest: is there a max number of actions?
Thanks very much!

Whether using KM Actions or a script, the best method would be data-driven in a loop.
So it would require only 20 or so Actions to implement.

So this can be easily implemented in loop using the KM Repeat action, and setting a loop index using a Set Variable to Calculation action.

Something like the below macro.

Below is just an example written in response to your request. You will need to use as an example and/or change to meet your workflow automation needs.

You will need to change the below Action to the number of seconds you want to pause between pages:


Please let us know if it meets your needs.


MACRO:   Loop Through Sequential Actions [Example]

**Requires: KM 8.2.4+   macOS 10.11 (El Capitan)+**
(Macro was written & tested using KM 9.0+ on macOS 10.14.5 (Mojave))

#### DOWNLOAD Macro File:
<a class="attachment" href="/uploads/default/original/3X/6/b/6bd5791329cf450d0fc6727db9142e38aaeb1b97.kmmacros">Loop Through Sequential Actions [Example].kmmacros</a>
**Note: This Macro was uploaded in a DISABLED state. You must enable before it can be triggered.**


### ReleaseNotes



* **Loop Through Pages in Preview with Multiple Windows**

**NOTICE: This macro/script is just an _Example_**

* It is provided only for _educational purposes_, and may not be suitable for any specific purpose.
* It has had very limited testing.
* You need to test further before using in a production environment.
* It does not have extensive error checking/handling.
* It may not be complete.  It is provided as an example to show you one approach to solving a problem.


1. **KM 8.0.2+**
2. **macOS 10.11.6 (El Capitan)**


* **Carefully review the Release Notes and the Macro Actions**
  * Make sure you understand what the Macro will do.  
  * You are responsible for running the Macro, not me.  😉
* Assign a Trigger to this maro.
* Move this macro to a Macro Group that is only Active when you need this Macro.
* ENABLE this Macro.
  * ALL Actions that are shown in the magenta color


* While I have given this limited testing, and to the best of my knowledge it will do no harm, I cannot guarantee it.
* If you have any doubts or questions:
  * **Ask first**
  * Turn on the KM Debugger from the KM Status Menu, and step through the macro, making sure you understand what it is doing with each Action.

<img src="/uploads/default/original/3X/d/a/dac2d8b7991120bdce129114b46b8131f8e2c616.png" width="579" height="1628">


### NOTE: You may need to adjust this Action


This assumes that the word "copy" is in the Title of the second window of Preview, as it is my setup, when I "duplicate" windows:

Main, original window with PDF:

2nd Preview Window from Duplicate

If your 2nd window does NOT contain "copy", then you will need to find another way to uniquely identify the 2nd window, and replace "copy" in this Action with that word or phrase.