     printUsage()
     exit(EXIT_FAILURE)
   }
-  password
+
+  let format =
+  "activate application \"Cisco AnyConnect Secure Mobility Client\"\n" +
+  "tell application \"System Events\" to tell process \"Cisco AnyConnect Secure Mobility Client\"\n" +
+  "click button \"Connect\" of window 1\n" +
+  "repeat until window 2 exists\n" +
+  "end repeat\n" +
+  "keystroke \"%@\"\n" +
+  "click button \"OK\" of window 1\n" +
+  "end tell\n"
+  
+  let source = String(format: format, password)
+  guard let script = NSAppleScript(source: source) else {
+    print("Could not create script!")
+    printUsage()
+    exit(EXIT_FAILURE)
+  }
+  
+  script.executeAndReturnError(nil)
+  
 }
 
-if NSUserDefaults.initialized == false {
-  NSUserDefaults.initialized = true
-}
+NSUserDefaults.initiliaze()
 
 if Process.arguments.contains(Options.setPassword) {
   setPassword(Process.arguments.last)

      return standardUserDefaults().stringForKey(DefaultsKey.password)
    }
    set {
      standardUserDefaults().setObject(newValue, forKey: DefaultsKey.password)
      standardUserDefaults().synchronize()
    }
  }
}

  runScript()
}

exit(EXIT_SUCCESS)