title: Applescript - list all running applications
body: <p>How can i get a list of running applications in the same order they appear when doing ⌘ + ⇥ from within an applescript? </p>
  
  <p>I.e. if I use <strong>TextEdit</strong>, then <strong>Preview</strong>, then <strong>iCal</strong>, the order is</p>
  
  <p>iCal, Preview, TextEdit</p>
  
  <p><a href="https://stackoverflow.com/questions/945033/getting-the-list-of-running-applications-ordered-by-last-use">This question</a> which asked if there was an API that could produce this list provided this answer:</p>
  
  <p>$ cd /System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework</p>
  
  <p>$ nm LaunchServices | grep __LSCopyApplicationArrayInFrontToBackOrder</p>
  
  <p>But how can I access this list from within an applescript?</p>