compile : disable replace

The program you are looking for is Keyboard Maestro! Very useful utility for all manner of things. I’d never thought of automating this, since as I say I just have it wired in my head—but since you bring it up, I gave it a shot and the following formula works great:

  • Trigger: The Hot Key Shift-Opt-Cmd-E is pressed.
  • Will execute the following actions:
    • Select ‘Compile…’ in the menu ‘File’ in
    • Type the Enter keystroke.
    • Type the Enter keystroke.
    • Pause Until Any Conditions Met:
      • Button with name ‘Replace’ exists.
      • Menu with name ‘Compile…’ is enabled.
      • Press button ‘Replace’

And that’s it. One keystroke will compile and overwrite the previously used path and filename. I have attached the macro for anyone that wants it. On a slower computer it may need another pause in between the two Enter keystrokes, but probably not since keyboard events are buffered until they can be used; you can press them faster than the computer can keep up with them, in other words. Just be careful to use either a timed pause, or one that has a fallback condition like the example, which bails out of the script if the Compile menu command is active (and thus the Compile sheet is no longer open). Otherwise it just hangs forever waiting for the Replace button to appear, and might fire off at a moment you wouldn’t expect it to, while doing something else that requests confirmation.
km_macro-compile_and_replace.tar.gz (1.05 KB)