title: Is it possible to send a key code to an application that is not in front?
body: <p>I'm writing a simple Automator script in Javascript.</p>
  
  <p>I want to send a key-code(or key-storke) to an OS X application that is not in front.</p>
  
  <p>Basically, I want to run this code and do my things while the script opens a certain application, write text, and hit enter - all of this without bothering my other work.</p>
  
  <p>I want something like this:
  <code>
  Application("System Events").processes['someApp'].windows[0].textFields[0].keyCode(76);
  </code></p>
  
  <p>In Script Dictionary, there is <code>keyCode</code> method under <code>Processes Suite</code>.
  The above code, however, throws an error that follows:
  <code>
  execution error: Error on line 16: Error: Named parameters must be passed as an object. (-2700)
  </code></p>
  
  <p>I understand that the following code works fine, but it require the application to be running in front:
  <code>
  // KeyCode 76 =&gt; "Enter"
  Application("System Events").keyCode(76);
  </code></p>
  
  <p><strong>UPDATE</strong>: I'm trying to search something on iTunes(Apple Music). Is this possible without bringing iTunes app upfront?</p>