title: Xcode 4 : Can I get a path to the currently active file via AppleScript?
body: <p>I am trying to write a custom xcode4 behavior to check out the current active file with Perforce. I know I can write a custom behavior to run when hit a key (e.g., <kbd>F1</kbd>) I'd like that custom behavior to launch an AppleScript (or any kind of script for that matter) that discerns the currently "active" source document in Xcode, get its path, and attempt to check it out via Perforce.</p>
  
  <p>As far as I can tell AppleScript is the best way to get to the target document as it can navigate the Xcode DOM easily. Given that, the DOM itself is a maze.</p>
  
  <p>Can this be done?</p>