title: What is the code used to switch back to a previously running window via Apple's Automator?
body: <p>I created a code that toggles the keyboard viewer in Automator.</p>
  
  <pre><code>on run {input, parameters}
      if application "KeyboardViewer" is running then
          quit application "KeyboardViewer"
      else
          activate application "KeyboardViewer"
      end if
      return input
  end run
  </code></pre>
  
  <p>However, the Keyboard Viewer becomes the current running window and I cannot instantaneously start typing (I have to switch back to the previous window). Is there a specific code that I can add so that the previous window is highlighted again ?</p>