Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

10.4: Set Command-F to search by 'Name Contains' Desktop
Tiger only hintWhenever I try to find a file in Tiger, as I could with Panther's Command-F, I get too many results -- Spotlight shows me too many things I don't need. So every time I hit Command-F, I need to reconfigure the search options to find Name Contains. What a pain!

But I found a way to get the old "Name Contains" default search back, using PlistEdit Pro 1.1.2. First, navigate to this file: /System: Library: CoreServices: Finder, then Control-click on the Finder and continue navigating to Contents: Resources: default_smart.plist. Make a backup of the file before you do anything else. Now replace all the text in that file with this text. Save the modified file, and restart the Finder. You can do that with Activity Monitor, or by Option-click-and-hold on the Finder icon in the dock. After a restart, you'll find that Command-F defaults to the 'Name Contains' search criteria.

[robg adds: I have edited this hint's writeup (but not the code) extensively -- OmiElGato is not a native English speaker, and I wanted to make sure that this hint was understandable by everyone, as it's clearly one of my favorite 10.4 tips thus far. I really hate the new Command-F behavior in the Finder, but that's a rant for another day. I don't have PlistEdit Pro, so I implemented the tip a bit differently -- I just used the Terminal. The only slight trickery (apart from needing to use sudo) is that the plist file needs to be converted to/from binary and XML to be worked on, as described in this hint. Once you have it in straight text, you can use vi or your favorite editor to make the changes. To change the default "contains" text from , change the string value What_File_you_need_By_OmiElGato to whatever you want. If you use my method, remember to convert back to binary when you're done editing ... and regardless of how you try this, please make a backup of the file before you start...]
    •    
  • Currently 3.29 / 5
  You rated: 5 / 5 (7 votes cast)
 
[32,640 views]  

10.4: Set Command-F to search by 'Name Contains' | 30 comments | Create New Account
Click here to return to the '10.4: Set Command-F to search by 'Name Contains'' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
10.4: Set Command-F to search by 'Name Contains'
Authored by: simX on May 09, '05 05:19:12PM

The code includes many extraneous things, like the sidebar width and the toolbar visible properties near the bottom of the plist file. I would advocate changing the hint a little so that you only replace the necessary text, or you use a GUI utility like the Property List Editor application that's included with the Tiger developer tools.



[ Reply to This | # ]
10.4: Set Command-F to search by 'Name Contains'
Authored by: dtheory on May 15, '05 02:52:44PM

it is true Omi's version sets some unneccessary parameters...
Also true is that TextWrangler works just fine.
A nice simple version is obtained by using the text:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>RawQuery</key>
<string></string>
<key>SearchCriteria</key>
<dict>
<key>CurrentFolderPath</key>
<string>/</string>
<key>FXCriteriaSlices</key>
<array>
<dict>
<key>FXSliceKind</key>
<string>Snam</string>
<key>Operator</key>
<string>S:**</string>
<key>Value</key>
<string></string>
</dict>
</array>
<key>FXScope</key>
<integer>0</integer>
</dict>
<key>Version</key>
<string>10.4</string>
<key>ViewOptions</key>
<dict>
<key>ViewStyle</key>
<string>Nlsv</string>
</dict>
</dict>
</plist>



[ Reply to This | # ]
10.4: Set Command-F to search by 'Name Contains'
Authored by: YA new user on May 15, '05 09:22:52PM

This together with plutil has worked nicely. unfortunately it only works on indexed disks.



[ Reply to This | # ]
10.4: Set Command-F to search by 'Name Contains'
Authored by: Kevinm78 on Feb 21, '06 11:00:55AM

Would it be possible for some knowledgeable person to take the program string offered in the first post and remove all of the unnecessary information that sets the window size, default text string, etc? I would like to have the normal window appear but with "name includes" as the default.



[ Reply to This | # ]
10.4: Set Command-F to search by 'Name Contains'
Authored by: gmartin on May 09, '05 05:29:50PM

I'd suggest:

1). using Finder to make copy the default_smart.plist to your desktop
2). using Terminal and sudo mv to rename the original as a backup
3). edit* the copy on you desktop with the usual Property List Editor.app**
4). use Finder to copy your modified file back (it will auto-ask you to authenticate)
5). use Activity Monitor.app to Quit (not Force Quit) Finder
6). click on the Finder icon in your Dock to relaunch

* Have a look at the hint's example .plist file if you want, but there are more changes there than you want... By default there should be 2 FXCriteriaSlices key/value pairs. Keep 0 and delete 1. Edit 0 so FXSliceKind = Snam and remove the Value = KI** so the search field will be blank by default.

** Property List Editor.app is part of the Developer tools



[ Reply to This | # ]
10.4: Set Command-F to search by 'Name Contains'
Authored by: jph000 on May 19, '05 09:05:12PM

Yes, Property List Editor was an easy way to edit a copy of the file. (Also made another backup copy using option drag.) Then replace authorized the original, and relaunched the Finder. All I did was match the code section:

<dict>
<key>FXSliceKind</key>
<string>Snam</string>
<key>Operator</key>
<string>S:**</string>
</dict>

Property List Editor's Dump (button) feature helped confirm the changes.



[ Reply to This | # ]
10.4: Set Command-F to search by 'Name Contains'
Authored by: maartensneep on May 09, '05 05:44:31PM

There are indeed some spurious bits in there (you can use those to set the default location of the window, or at least its size).

To figure out what admittedly rather obscure codes need to be filled out to specify a search, just create a smart folder, set it to your preferences, and save it. Open that file (yes a smart folder really is just a property list file) in the property-list editor, and change it as needed (you probably want no text as the default search string). Remove extraneous stuff, you probably want to copy the "FXCriteriaSlices" array, and nothing else to the default plist.

Maarten



[ Reply to This | # ]
10.4: Set Command-F to search by 'Name Contains'
Authored by: genericuser on May 17, '05 10:46:53PM

Has anyone tried to set the default to search only a particular volume?
As suggested above, I created a .savedSearch with search parameters to search by name on the main volume only, then changed it to a .plist, edited the .plist to take out the specific search term. When I change it back to a .savedSearch, it works as expected, but when I save the .plist file to the default_smart.plist file and use Cmd-F, it opens up set to some random search location (usually "Home")-- however, if I then hit Cmd-F a *2nd time*, it switches to the correct search location ("Macintosh HD")-- any idea what's going on here?



[ Reply to This | # ]
10.4: Set Command-F to search by 'Name Contains'
Authored by: jehrler on May 09, '05 08:51:19PM

While a good start, the text entry box still defaults to the Spotlight one in the toolbar (and if you remove it from the toolbar, it adds a search field to Find... that can not be removed, grrr). And you can't use the tab key to keyboard your way to the Name Contains text box.

So, for me anyhoo, I'm still using Easy Find.



[ Reply to This | # ]
10.4: Set Command-F to search by 'Name Contains'
Authored by: jonahlee on May 10, '05 09:02:20AM

Yea I agree it would be nice if it automatically defaulted to the name contains or if it would use that as the search criteria. I can uses for Spotlight, but actually prefer the old method of seach for name in most instances.

---
- Jonah Lee



[ Reply to This | # ]
10.4: Set Command-F to search by 'Name Contains'
Authored by: st4121 on May 13, '05 01:45:37PM

I fixed this problem with a two-step action in Quickeys:

1) Type keystroke cmd-F

2) Click relative to main window 489h 72v

I assigined this Quickey to cmd-F in the finder. You could probably do the same thing with iKey or some other macro utility.



[ Reply to This | # ]
10.4: Set Command-F to search by 'Name Contains'
Authored by: johnsawyercjs on Jan 25, '07 05:01:53PM
While a good start, the text entry box still defaults to the Spotlight one in the toolbar (and if you remove it from the toolbar, it adds a search field to Find... that can not be removed, grrr). And you can't use the tab key to keyboard your way to the Name Contains text box.
Actually, removing the Spotlight search field from the Toolbar in Find windows (actually removes them from all Finder windows) by selecting View: Customize Toolbar, and dragging it out of the Find window, is a nifty approach--it does add a new, separate "Search for" field to Find windows, but it meets all of our basic criteria here: it sits at the top of the list of find criteria; it finds by Name Contains; and the insertion bar defaults to this field. Of course, this prevents you from doing Spotlight searches in any window, but you can still find by content, etc. by selecting these options in the Find utility.

[ Reply to This | # ]
10.4: Set Command-F to search by 'Name Contains'
Authored by: johnsawyercjs on Jan 25, '07 05:26:31PM

Argh. Turns out with further experimentation that this doesn't always restrict the search to Name Contains--it does on my Mac, but on another Mac configured identically as far as I can tell (both using the patch described in this hint, and with the Spotlight search field removed from Find/Finder windows), it still searches by Contents.



[ Reply to This | # ]
10.4: Set Command-F to search by 'Name Contains'
Authored by: jacobolus on May 10, '05 07:08:36AM

Can anyone find the file (maybe also a plist, I don't know exactly), that defines what the spotlight menu and the find bar in command-F windows does? That would be incredibly useful. It could be edited to tweak spotlight's default behavior.



[ Reply to This | # ]
10.4: Set Command-F to search by 'Name Contains'
Authored by: jonahlee on May 10, '05 09:43:09AM

I actually prefered adding the entry to the plist, so I have 3 entries now, and I may customize it further using the smarlist presets that have been mentioned here.

---
- Jonah Lee



[ Reply to This | # ]
10.4: Set Command-F to search by 'Name Contains'
Authored by: barbarella on May 11, '05 10:24:34AM

Here is my totally ungeek solution for the problem. Configure a "Name contains" search in the Find window and search for something. Save the results as a smart folder and put it in the sidebar. Now, everytime you open the saved search you get a "Name contains" configured search window. Type in some new string and, voila, there you are.



[ Reply to This | # ]
10.4: Set Command-F to search by 'Name Contains'
Authored by: dfa4 on May 11, '05 10:29:27AM

am i missing something here. it seems to me that the default "name contains" search is already applicable by typing in the keywords in the Find windows search field. it seems superfluous or duplicative to add a name contains criteria to the search unless you are planning to save the search. am i not right? (actually, i know i am right, but i want to appear modest ;-)

---
--
Duane Fitzgerald Andrews
http://dfa4muse.com



[ Reply to This | # ]
10.4: Set Command-F to search by 'Name Contains'
Authored by: mahakali on May 12, '05 11:13:05AM

That's what I was thinking. I use toolbar search (command-option-f) when I need to search by name. I only use command F for advanced search. But maybe some people are used to using command-f for searching.



[ Reply to This | # ]
10.4: Set Command-F to search by 'Name Contains'
Authored by: Hal Itosis on May 12, '05 03:23:05PM
dfa4 writes:
> am i missing something here. it seems to me that
> the default "name contains" search is already
> applicable by typing in the keywords in the Find
> windows search field.


You certainly are missing something. Spotlight is everywhere.
Typing in the search-slot in Finder window toolbars is *NOT*
limited to "name contains" searching. 90% of the results are
content-based. (Tiger != Panther).

> it seems superfluous or duplicative to add a name contains
> criteria to the search unless you are planning to save the
> search. am i not right? (actually, i know i am right, but
> i want to appear modest ;-)


Wrong. No one is "adding" anything. Apple already provides the
Name (contains/begins with/ends with/is) field so we can limit
Spotlight's lust for content-based searching. What this hint is
trying to do is make it so the Name field appears automatically
at the top (so we don't have to manually mouse it ourselves all
the time).



mahakali writes:
> That's what I was thinking. I use toolbar search
> (command-option-f) when I need to search by name.


And did you not notice the (probably over 700) items in the results
list that DIDN'T contain the text you typed in their names!? Toolbar
searches find anything Spotlight wants them to find (not names only).

Myself, I WISH you guys were right... but it just ain't so.

-HI-

[ Reply to This | # ]
10.4: Set Command-F to search by 'Name Contains'
Authored by: jph000 on May 19, '05 08:48:02PM

"... am i missing something here. it seems to me that the default "name contains" search is already applicable by typing in the keywords in the Find windows search field. it seems superfluous or duplicative to add a name contains criteria to the search ..."

I thought so at first also. However, this week in testing Spotlight, I've found that I'm getting different results -- using the same search string, I'm getting different results using a Finder Window (search box) and cmd-f Name Contains search. All of which is puzzling and frustrating. (Yes, I've reindexed the volumes in question more than once.) I can be looking directly at a picture folder window, and cmd-f will find all the jpg files with names containing the substring, while the Finder Window search box will not.



[ Reply to This | # ]
Just Use Text Wrangler
Authored by: hedgeman on May 14, '05 12:45:06AM

You can open the plist file directly in the free Text Wrangler program. I opened it and just pasted in the text and then saved the file. It worked as soon as I restarted the finder.



[ Reply to This | # ]
Just Use Text Wrangler
Authored by: hedgeman on May 14, '05 12:45:07AM

You can open the plist file directly in the free Text Wrangler program. I opened it and just pasted in the text and then saved the file. It worked as soon as I restarted the finder.



[ Reply to This | # ]
Just Use Text Wrangler
Authored by: baltwo on May 31, '05 02:02:46PM

You don't need Text Wrangler or the PList Editor. I just copied the one from a smart folder plist, setting it up to search on a term with name contains and visibility as the options, into TextEdit, deleted the search term array, and saved it as default_smart.plist. I then backed up the original and dropped it into the Finder.app. Works like a charm.

Here's what I changed the default_smart.plist to—now CMD + F comes up with Name and Visible as its defaults.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>RawQuery</key>
<string></string>
<key>SearchCriteria</key>
<dict>
<key>CurrentFolderPath</key>
<string>/</string>
<key>FXCriteriaSlices</key>
<array>
<dict>
<key>FXSliceKind</key>
<string>Snam</string>
<key>Operator</key>
<string>S:**</string>
<key>Value</key>
<string></string>
</dict>
<dict>
<key>FXSliceKind</key>
<string>Svis</string>
<key>Value</key>
<string>No%20%20</string>
</dict>
</array>
<key>FXScope</key>
<integer>0</integer>
</dict>
<key>Version</key>
<string>10.4</string>
</dict>
</plist>

Delete these lines, if you don't want visible as an option:

<dict>
<key>FXSliceKind</key>
<string>Svis</string>
<key>Value</key>
<string>No%20%20</string>
</dict>



[ Reply to This | # ]
How about Contents box, too?
Authored by: AstroMacMan on Aug 03, '05 09:54:32AM

This was a great tip. Now, is there a way of adding another string <dict> entry so that it would also display the Contents box underneath the Name box.

That would really help.

Of course, I'd still like to get rid of the way it groups files and change the order it presents the groups, but, oh well, can't have everything!



[ Reply to This | # ]
10.4: Set Command-F to search by 'Name Contains'
Authored by: emmafoster on May 15, '05 07:22:27PM

So i have my command-f window searching only by name and visibility - gr8!!

how do i get it to default to typing on that search , not a new spotlight (oh, yes take forever why don't you) search. Involves me manually clicking the box with the mouse to search within the parameters.

emma :-)



[ Reply to This | # ]
10.4: Set Command-F to search by 'Name Contains'
Authored by: kindall on May 21, '05 02:09:52AM

Hit Shift-Tab twice. :)



[ Reply to This | # ]
10.4: Set Command-F to search by 'Name Contains'
Authored by: jedik on Aug 23, '05 07:37:34PM

This might sound stupid, but there is an even simpler workaround for this. I thought about it after using LaserLight for a while. To search only in the file name, just start with a " (yes, the quotations mark). It's a keyword/name search. Easier than hitting COMMAND+F, going to the other field and typing the search string. :D

Cheers

---
:: Jedi Knight ::
-- Mac Rules! --



[ Reply to This | # ]
10.4: Set Command-F to search by 'Name Contains'
Authored by: alhadeff on Aug 24, '05 02:03:07PM
Actually my testing indicates that prefacing your search criteria with a quote mark will search Titles (e.g the Title of an Event in iCal, the subject of an email in Mail, etc) and File Names including the full path. As posted in another hint it will also only do word based searching. I can't wait till Spotlight is updated. It'll hopefully become more usable soon.

[ Reply to This | # ]
10.4: Set Command-F to search by 'Name Contains'
Authored by: teorema67 on Mar 24, '06 03:06:21PM

I tried these modifications of the default_smart.plist. I still cannot find by name neither invisible items nor visible items within invisible directories.

The only method to make work the search of invisible items that i know is to disable indexing. Without index the finder's search works as it did in until Panther.

Is there a way to enable the finder's search without the need to disable Spotlight indexing?



[ Reply to This | # ]
10.4: Set Command-F to search by 'Name Contains'
Authored by: dstewart on Feb 03, '07 02:49:09PM

This is a nice tip, does just what I want... There is one more thing: Is there any way to have the Name text edit field selected, so you don't have to mouse or tab to the field, but can instead just start typing the file name/term you're looking for?

---
David



[ Reply to This | # ]