-1

I have an Apple script that I found somewhere that unminimizes windows. It worked on El Capitan but now it doesn't in Mojave. I assume there was a change of syntax but I know nothing about apple scripts.

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

Is there a way to get this script working again?

0

2 Answers 2

0

Your code, as is, works for me in macOS Mojave when run from Script Editor; however, I do have Script Editor set to have accessibility privileges for this to work properly.

If you are running that code from its own AppleScript app, or whatever you are running the code from, then you need to allow it accessibility privileges as described in the link.

Also note that the checkbox for [] Minimize windows into application icon in System Preferences > Dock must be unchecked for there to be a window to restore, if one is minimized.

To enable accessibility control for an app

  1. Launch System Preferences and click Security & Privacy.
  2. Click the Privacy tab.
  3. Click Accessibility.
  4. Click the Add button (+).
  5. Choose an app and click Open.
  6. Select the checkbox to the left of the app.
0

The problem is with updating it switched back to Australia language instead US english. So "minimized" is spelled "minimised" in the script. Also an updated script with error checking is below but change to minimised for UK or Australian English:

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .