Is there a way to un-minimize all windows that have previously been minimized?
I think I saw a macro to that affect a few days ago on this website. I'll see if I can find it.
Actually the answer may depend upon what you mean. Some applications have windows within the application and can be minimized/maximized independently of macOS. I'm inferring that that's not what you are talking about.
So in that case this is getting close to your requirement:
The problem is there's no action that lets you minimize or maximize an application by indicating the name as a string. You seem to have to pull down the name of the application from a list similar to this:
But I think one of the Wizards with AppleScript should be able to use the first dialog box above and add an AppleScript action that will maximize the "Name" string-indicated application. That would probably take me hours to figure out, so I'll pass on that.
That's the best I can do for you.
Application('com.apple.systemevents') .processes.windows .attributes['AXMinimized'] .value = false;
Though you may find slightly less visually-jarring results using this snippet of regular AppleScript, where the natural language syntax really comes into its own :
tell application id "com.apple.systemevents" to set value of ¬ attribute "AXMinimized" of (every window in (processes ¬ where window is in the class of windows and the value ¬ of attribute "AXMinimized" of windows contains true) ¬ whose value of attribute "AXMinimized" = true) to false
The difference between these two functionally is that the former applies the change in attribute value to every single window, whether it needs to be changed or not. The very act of doing this can cause an application to move to the front, which can add to the already-unappealing diarrhoea of animations being thrown at you. The latter applies the change only to those windows that need to be changed: slightly less diarrhoea, but whatever application that was originally at the front now won't be (but you can easily just set it to the front as the last action of the macro).
I tried putting the JSA code into a macro and it gives error -1743:
The AppleScript also gives an error 48:290, "Not authorized to send Apple events to System Events."
@Sleepy, please do not post offensive text. Very unprofessional. I removed it.
Hmm, you are right. I regret it. I'm sorry. I will refrain from posting for a while until my guilt recedes.
Yes, you need to authorise your application to control
System Events. It's under Accessibility of System Preferences.
That's a super-awesome script. Thanks for posting.
I had use for a modified version that only raises the window of the frontmost application. Here's the modified code:
tell application id "com.apple.systemevents" to set value of attribute "AXMinimized" of ( every window in ( processes where frontmost is true and window is in the class of windows and the value of attribute "AXMinimized" of windows contains true ) whose value of attribute "AXMinimized" = true ) to false