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.
tell application "System Events"
tell process "Dock"
tell list 1
try
set minimizedWindows to every UI element whose role description is "minimized window dock item"
if minimizedWindows is not {} then
click last item of minimizedWindows
else
say "No minimized windows" volume 0.5 without waiting until completion
end if
on error errstr
display alert errstr
end try
end tell
end tell
end tell
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.:
tell application "System Events"
tell process "Dock"
tell list 1
try
set minimizedWindows to every UI element whose role description is "minimized window dock item"
if minimizedWindows is not {} then
click (every UI element whose role description is "minimized window dock item")
else
say "No minimized windows" volume 0.25 without waiting until completion
end if
on error errstr
display alert errstr
end try
end tell
end tell
end tell