I am trying to write a macro to automatically clear all the pre-defined names in Handbrake’s chapter section. Often it says “Chapter x” where x is the chapter number.
What I basically want it to do is:
- Activate Handbrake
- Go to Chapters section
- Select first item
- Go through list and press “Delete” then “Return” for each line. Return brings it to the next line.
However, it doesn’t seem to always work. Can anyone offer some assistance? Thank you!
“doesn’t seem to always work” is a bit vague, it makes it hard to know what to suggest.
But the primary reason for fragile macros is timing. Make sure you use appropriately placed Pause Until or Pause actions.
For example, Activate Handbrake - Keyboard Maestro will wait until its at the front, but if it is launching, it may well claim to be at the front and launched before it even opens the window. So you may need a Pause Until the window is setup.
Similarly, anything that changes focus or changes windows, you may need to pause until the focus is in the right place.
After that, simulating a sequence of Delete/Returns should be fine, but again, you may find if Keyboard Maestro types at full speed the app gets behind and gets confused.
Anyway, those are the things I would look at, but without knowing what you mean be “doesn’t seem to always work” its hard to say more.
It did end up being a timing issue. I added a .2 second delay and it helped. Isn’t perfect but it helped 90% of the way. I need to try a little more to get it perfect, but thank you for the fast response!