title: Get return values from Applescript in Swift
body: <p>Is it possible to run a Applescript in Swift and receive the return values? 
  I have a script like the following. How can I run this in swift and receive the return value?</p>
  
  <pre><code>global frontApp
  set windowTitle to "
  tell application "System Events"
      set frontApp to first application process whose frontmost is true
  end tell
  return {frontApp}
  </code></pre>
  
  <p>my code would be as follows</p>
  
  <pre><code>var set: String = "set windowTile to \"\"\n"
  var tell: String = "tell application \"System Events\"\n"
  var setFrontApp: String = "set frontApp to first application       
                             process whose frontmost is true\n"
  var setFrontAppName: String = "set frontAppName to name of frontApp\n"
  var tellProcces: String = "tell process frontAppName\n"
  var tellFirst: String = "tell (1st window whose value of attribute          
                                \"AXMain\" is true)\n"
  var setWindowTitle: String = "set windowTitle to value of 
                                 attribute \"AXTitle\"\n"
  var endTellFirst: String = "end tell\n"
  var endTellProcess: String = "end tell\n"
  var endTell: String = "end tell"
  var startAtLoginScript: NSAppleScript = NSAppleScript(source: tell 
                                          + deleteItem + endTell)!
  startAtLoginScript.executeAndReturnError(errorInfo)
  </code></pre>
  
  <p>Can you tell me where my result should be or what I did wrong? If I print out errorInfo or tracking the result is some strange number. </p>