title: How to run an application in "background" or "hide" an application using apple script?
body: <p>I am trying to start and hide quicktime player, start recording my iPhone screen for some duration and save the output on the desktop with file name "hello" with the below script</p>
  
  <pre><code>on run
      set filePath to (path to desktop as text) &amp; "hello.mov"
      set f to a reference to file filePath
  
      startVideoRecording(f)
  
  end run
  
  on startVideoRecording(f)
  
      tell application "QuickTime Player"
          activate
          tell application "System Events"
              keystroke "h" using command down
          end tell
          set newMovieRecording to new movie recording
          set camera to "Prabhu Konchada's iPhone"
          tell newMovieRecording
              set camera to "Prabhu Konchada's iPhone"
              start
          end tell
          delay (10)
          pause
          save newMovieRecording in f
          stop
          close newMovieRecording
      end tell
  end startVideoRecording
  </code></pre>
  
  <p>To hide quicktime player I tried :</p>
  
  <ol>
  <li>tell application "System Events" to tell process "QuickTime Player" to keystroke "h" using command down.</li>
  <li><p>tell application "Finder"
  set visible of process "QuickTime Player" to false
  end tell</p></li>
  <li><p>tell application "System Events"
  set frontProcess to first process whose frontmost is true
  set visible of frontProcess to false
  end tell</p></li>
  </ol>
  
  <blockquote>
    <p>The above 3 methods didn't serve my purpose and I don't want this quicktime all over my screen or visible in my DOCK ...</p>
  </blockquote>