Sierra Automator KeyboardViewer App Shortcut
Solution 1:
Thanks all! process whose frontmost is true and visible is true
froze Keyboard Viewer behind a Finder window that also froze - 2 freezes in 2 days. Following seems to work quite well, in macOS 10.13.2. Simply add the delay 1
.
on run {input, parameters}
if application "KeyboardViewer" is running then
quit application "KeyboardViewer"
delay 1
else if application "KeyboardViewer" is not running then
activate application "KeyboardViewer"
end if
return input
end run