Determining if Clipboard History Switcher is open

I think that'll break if the "Named Clipboard Switcher" is open but minimised. This script should cater for that eventuality as well:

tell application "System Events"
	tell application process "Keyboard Maestro Engine"
		try
			set value of attribute "AXMinimized" of item 1 of (every window whose name is "Clipboard History Switcher") to false
			return 1
		on error
			try
				set value of attribute "AXMinimized" of item 1 of (every window whose name is "Named Clipboard Switcher") to false
			on error
				-- do nothing
			end try
			return 0
		end try
	end tell
end tell

You could do away with the error blocks and use your "get list, if list count > 0" construct if you prefer that more explicit way of doing things.

1 Like