How to Pause Macro When Auto Save Window Pops Up

Hi there,

I use some macros in my video editing software to speed up repetitive multi-step tasks and I'm wondering how to handle auto save pop up windows that break my macros. The only way I can think to do it is to have each action only occur if the front window is not "auto save" but that would be a really laborious way to build the macro. Otherwise I can turn auto save off every time but this is dangerous for my workflow in case I forget to turn it back on.

Any thoughts would be greatly appreciated!
TY

Hi @hayleyh, it's a little difficult to advise without more information with regards to the app and the autosave feature. For example, how is it invoked and how is it bypassed?

But I'll take a shot anyway...

If you are using Keyboard Maestro 10+, you could create a subroutine macro that has two modes: one that turns off autosave and one that turns is back on. Then in each individual macro, call this subroutine specifying Mode 1 at the start and Mode 2 and the end.

As a precaution, you could also create a macro that is triggered when your video editing app launches that checks the state of autosave (and maybe even enables it if it has been disabled).

Good ideas, a little tricky to work with in my case. I use Adobe Premiere and the auto-save is triggered on a time interval which I can set via a preferences menu, unfortunately it's not toggle-able from the menu bar so no way for KM to know if it's enabled or not. A lot of stuff in Premiere is like this, which makes using KM with it pretty challenging, there are a lot of potential issues that I have to watch out for which means that I'm often cancelling and restarting my macros. For those reasons I'd probably prefer to just change the auto-save manually than go that route at this time. Thanks for the thought though!

I'm curious to know how you would use the front window as a condition. It's no more laborious than adding a single if/else to the start of your macro. This is just an example, as I don't know the actual window title off the top of my head. You don't have to put the rest of your macro in the otherwise section; you can collapse the if/else and just put the rest of your macro after it. Easier to look at that way.

This assumes that the autosave window is visible to the KM Engine.

However, would this even solve the problem? What if you're mid-macro and the window pops up?

Edit: It's 3am and I must be tired because I got the if/else the wrong way round. Corrected now. :sleeping:

Edit 2: Just had an idea: why not turn off Premiere's autosave and roll yer own?

You can use the Periodically while logged in trigger while Premiere is running, set to five minutes (or whatever you like), and your multi-step macros could begin by disabling the autosave macro and end by enabling it. Never done this myself, but I think it could be a decent solution. The only thing I'm not sure of is whether the timer resets when you enable the autosave macro. Presumably, you wouldn't want it to, as running lots of macros would potentially postpone saving by more than would be desirable.

I would probably write something horribly inefficient like this for each action.

Screen Shot 2022-03-28 at 7.07.30 PM

You're right, your screenshot solution wouldn't solve the problem for me because the autosave window can occur at any time and so each step would need to be safeguarded against that interruption in order for it to work. I should also mention that my intended functionality would be for it to pause while the auto-save occurs and then pick back up where the macro left off when it finishes.

I'll look into "periodically while logged in" thanks for the tip!

I second this idea. You could even attach some kind of countdown help you know when your autosave is coming.

In the past I've done something like sending a notification every second for the X seconds before whatever scheduled process is about to happen. 30 seconds... 10 seconds... depends how much of a warning you need. There might be better options though. Maybe some kind of status HUD?

Then, you could write a companion macro to "do the auto-save now" for when you want to save now so you're not interrupted by the autosave that is fast approaching.

Just did a quick test disabling and enabling a periodically triggered macro and it seemed to maintain its timing. Don't quote me; as I mentioned earlier, I'm half asleep. Give it a try and maybe include a notification so you can keep an eye on it while testing.

Bed time for me!

I did think about notifications and timers, but I thought it might be a bit of a rabbithole. Perhaps with your previous experience, it might not be too overwhelming. Just moderately whelming.

I envisioned a window of, say 5 seconds before the save, within which running a macro would notify "Premiere is about to save... Please hold..." and then wait until the save is completed before running the macro. I wouldn't know how to achieve that, but I can imagine it's probably doable.

1 Like

Would it be easier to disable the built-in autosave and create a macro the periodically saves using the menu? If so, that macro could include logic to bypass the save if another macro is running.

If this idea sounds feasible, I'd be glad to share more details.

1 Like

Great minds eh. Right I really am off to bed now. Night night!

Yeah it could get complicated pretty easily.

At first I was thinking "how can I schedule a timer before the periodic save?" but then I realized that it could be more simple. Instead, you could just add the timer the start of the periodic save macro.

An auto-save would always start with a countdown of notifications on repeat. If you weren't ready, you could stop it while counting down or you could have another macro for the "not now, I need more time!" case

Ah I see, you're suggesting I replace Premiere's autosave function with a custom one in KM. That would be slightly more complicated since what Premiere is technically doing there is saving my project and then also a copy of my project into a separate directory which is critical. There's also a smart element of how it chooses the exact moment of when to save that I'm not sure I could replicate. It could be opening a can of worms but auto-save is sort of my nemesis for a variety of problems I have in Premiere so might be worth looking into.

After reading your description of Premiere's Auto Save I found this: Save & back up projects in Adobe Premiere Elements

Considering both, I think it would be difficult to replicate the built-in Auto Save feature.


I see @kraftyDevil and @noisneil suggested using a timer. I presume they are suggesting that your macros could check for the impending save; and bypass the normal steps (and alternatively generate a brief message) if they happened to be triggered during the window.

I think that approach seems feasible if you can reliably predict the Auto Save time. Can you? If Auto Save is set to 15 minutes, does the save occur exactly 15 minutes after the Premiere document is opened? What if it is opened, but you make no changes during a long idle time?

Maybe Auto Save times could be predicted based of file and/or folder modifications dates.


Another thought...

Is Premier scriptable? If so, can any of these ideas be implemented with embedded AppleScripts?

1 Like

It definitely looks impossible to make user triggered backups, which is what Auto Save does. It's kind of confusing that Auto Save doesn't create saves - it makes "backup files", but I suppose there are advantages to just calling it "Auto Save".

I was suggesting to make a macro that just does a manual saves automatically every X minutes, adding timer notifications Y seconds to the start of that macro.

Here's a rough sketch:
Auto Manual Save with Warning.kmmacros (4.5 KB)

One issue is that it will take system resources to just pause for X minutes. I think you might be able to get around this by using cron triggers but it might get complicated and I'm out of brain juice for the day.

1 Like

Correct me if I'm wrong, but isn't Premiere just saving, duplicating the project file to a folder and then timestamping it? I must be missing something because that sounds achievable. You'd have to get the project directory somehow...

I tried to get the path of an open project in Premiere, but no luck. Doesn't seem to want to grab it. I'm still an applescript beginner, so maybe I'm going about it in the wrong way.

tell application "Adobe Premiere Pro 2021"
	try
		return path of front document
	on error
		try
			return POSIX path of (get file of front document)
		on error errorMessage
			return errorMessage
		end try
	end try
end tell

The path is also visible in the main window title, so if there's a way to get specifically that window's title...

Having said all that, the more I think about it, maybe this is all more trouble than it's worth.