I would investigate whether your synthesized key events are being
properly posted. You can write an app to "listen" and log key press
events (essentially, a key logger). Maybe you'll find that the
problem is on your end. That would be a happy thing since you are
at least in a position to fix it.
I'm pretty sure what I'm seeing is Pro Tools not handling the keys I
send.
If I add pauses between key events I get the desired result so the
key events themselves are fine.
it is also the case that the more work Pro Tools has to do between
key events the more likely an error.
is there some way to get the kind of stats I see in Activity Monitor?
eg. CPU usage per process, memory usage per process.
I could theoretically take baseline readings for the "idle" app
before I run my routine, then check the values before deciding if
it's safe to send a key event.
pretty shonky but might be an option.