content: use AppleScript version "2.4" -- Yosemite (10.10) or later
  use scripting additions
  
  on minimizeAllNonActiveWindows()
  	tell application "System Events"
  		-- a list of visible applications, containing a list of windows, containing a list of (one) buttons
  		set theResults to get buttons of (windows of (application processes whose visible is true)) whose description is "minimize button"
  		repeat with anApp in theResults
  			if contents of anApp is not in {} then
  				-- windows are open
  				repeat with eachWindow in (items of anApp)
  					-- only the one minimize button
  					click first item of eachWindow
  				end repeat
  			end if
  		end repeat
  	end tell
  end minimizeAllNonActiveWindows