{"id":54,"date":"2005-11-06T13:03:22","date_gmt":"2005-11-06T20:03:22","guid":{"rendered":"http:\/\/www.red-sweater.com\/blog\/?p=54"},"modified":"2005-11-06T14:40:05","modified_gmt":"2005-11-06T21:40:05","slug":"quickly-find-project-files-in-xcode","status":"publish","type":"post","link":"https:\/\/redsweater.com\/blog\/54\/quickly-find-project-files-in-xcode","title":{"rendered":"Quickly Find Project Files in Xcode"},"content":{"rendered":"<p>I like the Search-Fieldy kind of thing in Xcode. If you select the top-level project item in the &#8220;Groups and Files&#8221;, and then enter something in the search box, it makes it really easy to pinpoint a particular file that is contained by your project. <\/p>\n<p>\nApple even gave this search box thingy a keyboard shortcut, and include a menu item in the View menu for accessing it: &#8220;Detail&#8221;. I don&#8217;t really get the name of that menu, but needless to say it will switch you over to the search box thingy whenever you invoke it.\n<\/p>\n<p>\nProblem is, I am almost 100% likely to want to search my entire project when I switch to it, but Xcode doesn&#8217;t do this for me. I hit shortcut and then I inevitably have to go click the project icon in the outline view before switching back to the search box to enter text.\n<\/p>\n<p>\nUsing GUI Scripting, I was able to solve this dilemma by writing a small script that simply clicks the project item for me before switching to the search field. The script asks the &#8220;Groups and Files&#8221; outline view for the &#8220;first top level item whose name is the same as the name of the project.&#8221; I&#8217;m pretty sure this will always be the desired row of the column, even if you&#8217;ve done some funky reordering of items.\n<\/p>\n<p>\nClick here to download: <a href=\"http:\/\/www.red-sweater.com\/AppleScript\/FindProjectFile.zip\">Find Project File<\/a><\/p>\n<p>\nI used <a href=\"http:\/\/www.red-sweater.com\/fastscripts\/index.html\">FastScripts<\/a> to assign an Xcode-specific shortcut override. Now when I hit the Cmd-Opt-F shortcut for &#8220;Detail&#8221; it behaves as usual, but clicks the project icon for me on the way.<\/p>\n<p>\n<b>Update:<\/b> Xcode&#8217;s &#8220;whose clause resolution&#8221; started flaking out and giving me false hits, so I decided to just rely on the Project item being the first item in the Files and Groups list. This has the added benefit of making the script a lot faster, but it means it won&#8217;t work if your Files and Groups list is customized with the project not at the top.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I like the Search-Fieldy kind of thing in Xcode. If you select the top-level project item in the &#8220;Groups and Files&#8221;, and then enter something in the search box, it makes it really easy to pinpoint a particular file that is contained by your project. Apple even gave this search box thingy a keyboard shortcut, [&hellip;]<\/p>\n","protected":false},"author":10,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7,6,5],"tags":[],"class_list":["post-54","post","type-post","status-publish","format-standard","hentry","category-applescript","category-fastscripts","category-xcode"],"_links":{"self":[{"href":"https:\/\/redsweater.com\/blog\/wp-json\/wp\/v2\/posts\/54","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/redsweater.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/redsweater.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/redsweater.com\/blog\/wp-json\/wp\/v2\/users\/10"}],"replies":[{"embeddable":true,"href":"https:\/\/redsweater.com\/blog\/wp-json\/wp\/v2\/comments?post=54"}],"version-history":[{"count":0,"href":"https:\/\/redsweater.com\/blog\/wp-json\/wp\/v2\/posts\/54\/revisions"}],"wp:attachment":[{"href":"https:\/\/redsweater.com\/blog\/wp-json\/wp\/v2\/media?parent=54"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/redsweater.com\/blog\/wp-json\/wp\/v2\/categories?post=54"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/redsweater.com\/blog\/wp-json\/wp\/v2\/tags?post=54"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}