Trigger on CPU letting up?

Hey all,

I found a few topics on quitting Apps that run hot, but I’m looking to do some magic with Marco’s Forecast. Basically, this Hazel script will fire when a wave appears in a shared Dropbox folder. Forecast immediately starts processing it.

The beauty of Forecast is that it’s designed to hyper-thread like crazy and chew up all the CPU resources it can. So it normally gets up to about 400% on my older iMac.

Once the encoding is done, it drops back down to the usual idle 1 or 2%, that’s when I want KM to send “Command + S”, wait “Enter”, wait, “Command + Q”

So… any thoughts on that?
Thanks all!
Dr. Peril

Hey @Dr.Peril,

This is far from turn-key, but it should give you some ideas.

Have Hazel run a macro that enables this macro when the Forecast script fires.

Then when the CPU-usage threshold is less than what you've set in local_MaxLoad have the macro perform your task and disable itself when finished.

At the moment the macro runs every 10 seconds and shows the CPU-usage in a notification.

I recommend setting the interval to every 5 minutes or so

You'll have to experiment a bit to decide on the beast MaxLoad setting.

-Chris


Processer Load ⇢ Perform Actions when Load is Less-Than n.kmmacros (6.5 KB)

By the way – it's a better/safer practice to use the Select or Show a Menu Item action (when possible) rather than to send keystrokes to an application.

-Chris

Hey Chris,

Thanks for adding a downloadable macro, you're a champ!
Super excited to play with this and see what I can make Forecast do, thanks a ton :smiley:

I'll investigate the menu commands as I agree they're better but the App doesn't support much in the way of scripting, but if I can make it happen that way I will.

I'll let you know how it goes,
Thanks again!
~ Dr. Peril

No scripting required if there's a menu command available.

By way of example – a Select or Show a Menu Item action.

image

-Chris