tell application "System Events" to tell process "Dock" set dockUIElements to UI elements of list 1 repeat with i from (count dockUIElements) to 1 by -1 set anElement to item i of dockUIElements if ((role description of anElement) as string) is equal to "minimised window dock item" then click anElement exit repeat end if end repeat end tell