I have a script written for El Capitan that upgrading to mojave it stopped working. Is there a way to get the unminimize the most recent window back? Here is the previous script I used:
try
tell application "System Events" to tell process "Dock"
click (last UI element of list 1 where role description is "minimized window dock item")
end tell
end try
Your script seems to work fine, but I've tricked it out with some conditions and error checking to make any problems a bit easier to diagnose and manage.
EDIT
Per comments: as I said, I didn't really change the code, I merely added error-checking. To open all minimized window at once, use the code you already have inside the try block. i.e.: