How to loop through a dropdown (and do different things per dropdown entry)

Hey There,

I am looking for a clever way to automate reports (generate one report per entry in a dropdown list that needs to be named like the label on the dropdown).
This is how it looks like:

The dropdown is not memorizing the last position but I can type in the label name and select the label with Enter.

What seems to be a way to tackle that is to have an array of the label names (imagine a text file with each line being one of the labels in the dropdown).
So I could loop through that array and with each loop

  • Click on the dropdown
  • Type the name of the label (=the next line in the text file)
  • Generate the report#
  • Name the report (again the line in the text file)

I don't know if there is any better way to do that - and I have no idea how to solve that in KM. Can anyone chime in?


Presuming you can click on the Kategorie title, and then it shows the menu and presuming you can use type ahead to select the desired entry, then you can use the For Each action with the Lines In collection to iterate through a file or text, line by line, and perform the click, pause, type the string, type the return key, probably pause, then do whatever you need to to perform the rest of the process.

Hey David,

Welcome to the Keyboard Maestro Forum!  :smile:

If you haven't read these they're worth a couple of minutes of your time:

Tip: How Do I Get The Best Answer in the Shortest Time?

How to Post Your Macro to the Forum

What software are you working with?


Hey Peter,

that was it. I built it in no time. Thank you!


1 Like