This seems like such a basic task, but I\'m stumped.
How, in Xcode, do you execute a textual search though (the XML contents of) all the .xib files in a project?
This works if you use as service....
on run {input, parameters}
display dialog "XIB Search Text" default answer ""
set searchtext to text returned of result
if (length of searchtext) is greater than 0 then
tell application "Xcode" to set theProjectPath to (the project directory of front project)
tell application "Terminal"
set newWin to do script "cd " & theProjectPath & "; " & "rm " & theProjectPath & "/searchXIB.txt 2> /dev/null ; grep -i -r --include=*.xib " & searchtext & " . > searchXIB.txt ; exit"
activate
repeat while (exists newWin)
delay 1
end repeat
tell application "Xcode"
set doc to open theProjectPath & "/searchXIB.txt"
activate
end tell
tell application "System Events"
keystroke "f" using {command down}
keystroke searchtext
end tell
end tell
end if
return input
end run