BBEdit and Xcode integration

It just made me thick to edit large files in Xcode that I completly switched to BBEdit now.
The one thing I missed most was to quickly find the selected text in the Apple headers. So I have written an apple script for this which uses Spotlight and BBEdit’s multi search I like to share with you :

AppleScript [Show Plain Code]:
  1. set MacOSSDK to "/Developer/SDKs/MacOSX10.4u.sdk/System/Library/Frameworks/"
  2. tell application "BBEdit"
  3.         set fdoc to name of front text document
  4.         set searchString to (selection of text of front text document) as text
  5. end tell
  6. set command to "mdfind "kMDItemTextContent == ‘" & searchString & "’" -onlyin " & MacOSSDK
  7. set mdResult to every paragraph of (do shell script command)
  8. if (not mdResult = "") then
  9.         set fileList to {}
  10.         set fileListRef to a reference to fileList
  11.         repeat with posixFile in mdResult
  12.                 copy POSIX file posixFile to the end of fileListRef
  13.         end repeat
  14.         tell application "BBEdit"
  15.                 set search_opts to {starting at top:true, case sensitive:true, match words:true}
  16.                 set searchResult to find (searchString as text) searching in fileList options search_opts
  17.                 activate
  18.         end tell
  19. end if

0 Comments : 12.27.06