Minimize All Windows of All Applications Other Than The Front Window of the Active Application Macro Needed

It minimizes the windows of many of my running apps, but not all of them, and I haven't yet gotten it to a point where it successfully restores the frontmost window at the time the macro is run. Basically, in its current state, it errors out before it can finish its task, but it does work up to that point.