I have a long, multi-action macro that runs when I plug my laptop into the docking station on my desk. Ideally, I'd like to turn screen updating off, so I don't have to watch the execution of each macro action. As a plus, it would be nice to have a progress meter to show how far along the macro is. Does anyone know if this is possible?
May I ask for clarification? Are you saying you want the progress meter to show on the laptop while the docking station's monitor is off? Is that the goal? And is your docking station connected to an external monitor or an iMac? External monitors might not support power or dimming switching via macOS. Mine doesn't seem to.
What is the real goal, if it's not to "save you from having to watch the macro run"? (Surely you aren't suggesting you are distracted by a running macro.) Is it to save electricity? If so, we could potentially write a macro that would dim the screen as much as possible while your macro runs, assuming that macOS has access to your monitor's brightness.
And yes, a progress bar is possible for nearly any macro. You would just have to insert the progress values at points during its run time. I would think that progress bars are not possible when a macro consists of a single action. However I bet I can set up an asynchronous macro that could sometimes work even in that case, depending on what the macro does.
Depending on whether we find a software solution, you can always solve this problem using HomeKit and hardware since KM (with some effort) can be made to turn HomeKit devices including smart switches for your monitor on and off.
Thanks for your reply. My laptop is connected to two external monitors. I don't want to turn off the monitor or dim it in any way; I merely want to turn off screenupdating, so I can't see the macro running. It just looks more professional.
For example, in Visual Basic there’s a screenupdating property that you can set to false. When you run the program, you still see the same screen you were looking at before you started the program, but the process is running without updating the screen.
The purpose of the progress meter is just to let the user know that stuff is still having even though they can't see it. It's like it’s all happening “behind the curtain.”
Does that make sense? This isn't about anything other than aesthetics.
ON THE ONE HAND, VB in MS Word can control MS Word's updating features because they are integrated products. But KM is not an Apple product nor is it integrated with whatever (unstated) apps you are thinking about. Are the apps from Apple or from some third party? In theory those apps might have something similar to your screen updating property, but that's on them... not on KM. If those apps do have something like that, KM could very likely trigger that functionality. But again, you haven't told us what those apps are.
ON THE OTHER HAND, with all that being said, macOS does support multiple workspaces, (try pressing CTRL RIGHT ARROW to see what I mean) which is a feature I have never used, and maybe we could move the apps that you want to hide from the visible workspace to one of the hidden workspaces. That would probably make the app "invisible" as you seem to want. But if you say "I still want to see the app, I just don't want to see it doing anything," then I guess that's really on the app to support.
I believe Apple provides no API for that, and when Keyboard Maestro is working the UI it must be available.
Depending upon what you're doing you might be able to put up a Custom HTML Prompt action.
I think this is probably a case where “the juice isn’t worth the squeeze.” Thanks for your input. I like your creativity!
Do you think the NSDisableScreenUpdates() function might work? I think that is an Objective C function. It would be cool to have a Keyboard Maestro plug in that would include two actions: “Turn Screen Updating Off” and “Turn ScreenUpdating On.” You could use one at the beginning of a macro and the other at the end. It would also be great to have a progress meter display and update as the macro runs.
Thanks. I shouldn't answer your question for CC, but I will try anyway... I don't think that your proposed objective C API call will work in any program other than the one compiled with that function call. Which is what I was getting at in my paragraph that started with "ON THE ONE HAND."
If you look in the developer documentation for that you'll find it's been deprecated.
There might be a replacement, but I'm not going fishing today...
I think Peter would not likely offer an ability to disable the screen, because of the likelihood of people causing themselves grief by turning it off and forgetting to turn it back on again – and while it could theoretically have a time-out – it would probably cause too many hassles.
But let's ask the man...
No. “for all windows belonging to the calling process”.
As to the question of blanking the screen or otherwise disabling UI, it can't be done as far as I am aware, certainly not with any public API. And if it could, it would almost certainly disable UI actions, just like every other way of blanking the screen does (eg screen saving, screen sleeping, screen locked).
Maybe with some enterprise management software it could.