Minimize/Unminimize

I'm glad you got it working, but the solution you provided appears to be much different than the question you asked: You asked why a set of actions didn't work to minimize then unminimize a specific window, and that's what people answered.

But it seems, at least from reading your script, that your question was really "How do I unminimize any minimized window in any app?" What is the actual objective you're trying to accomplish?

If you're trying to unminimize all windows in all apps, you're much better off using window properties, which are the same across all apps. In particular, AXMinimized is true for any minimized window. Its use in unminimizing all minimized windows has been covered in this thread:

If you're asking something else, I'm unclear on what it is—I tried to answer the question you explicitly asked, which was about a single window in Safari.

-rob.