Smart Searches in Mac OSX Tiger
August 19th, 2007 by brush
I had been a user of Mac OSX Tiger for quite some time before plucking up the courage to explore Smart Folders and Automator Actions. I remember at the time that there was not a huge amount of information available on the web for either of these utilities, so Google searches, and simple trial and error figured greatly in the learning curve.
In the example below, I will demonstrate how to use a Smart Folder to power search pre Painter X (and extension stripped Painter X) Color Sets. I don’t intend this to be a step by step tutorial, but will give you some links to get you up to speed;
Organizing related files with Smart Folders
How to create and use Smart Folders in OSX
Adding application aliases to your Finder windows
Customize Finder view modes in OSX
Getting back to our Color Set searches, we can use a pre-saved smart folder, in this case to find Color Set files by file name, content text (for named color set swatches), and even those containing specific RGB values (see later comment). Spotlight comments may also be searched.
Below is a screen shot of my Color Set Smart Folder, activated within the Finder.

The default saved Smart Folder search (’Search for’ pane left blank by default) in the above is selected to search my whole computer, but in this example, I have selected the Startup P1 Volume in the Finder. You will also discover that by adding application aliases to the top of the Finder window, will force the normal Finder search window off the right edge, which then automatically converts to a different format of ‘Search for’ window when initiating the Smart Folder search. I can also access the search pane by clicking on the double arrow, top right of the Finder window, and selecting Search from the resulting menu.
By selecting Text in the Kind field, and adding HV SV VV(-svg) in the Contents field, only Painter Color set files will be found in the search. The idea is to use the content field to display only files containing HV SV VV in their content, thus filtering out any other text file which does not contain the search terms. In practice, I had to further modify this using (-svg) to exclude several non-Painter color set files from being included in the search results. Without changing any of the above search criteria, if I were to subsequently select ‘Computer’ as the search location from the Finder window, this would list every Painter Color Set file present on my computer.
Searching Painter X ‘.colors’ Files
You will notice from the previous screen shot that Painter X color set files can be searched, however, for Tiger to recognize them as text files, the ‘.colors’ file extension must first be removed (presumably removing cross platform compatibility). I understand that this issue will be fixed in OSX Leopard, whereby the associated file extension can remain intact. To remove the .colors file extensions in the Finder, I selected them all in the Finder, and used an Automator ‘Remove extension’ plugin available from Paulo Grifantini’s website.
Another Painter X Issue
Apart from having to remove the .colors file extension for Tiger to recognize the associated documents as text files, I noticed that several of the Color Sets in the Support Files> Color Sets folder have been written in short form notation e.g (from the Gray Range);
R: 059, G:059, B:073
not
R: 059, G:059, B:073 HV:0.00, SV:0.00, VV:0.00
Again, there is a workaround of adding the HV:0.00, SV:0.00, VV:0.00 to just
one line in the color set document, but without this addition, the Smart
Folder filter text I am using; HV SV VV(-svg) would not find these files.
Incorporating Spotlight Comments
Right clicking a color set icon in the Finder will bring up a contextual menu. Selecting ‘Get Info’ from this menu brings up the Get Info dialogue, where Spotlight comments may be entered. Comments may include a download url (if the Color Set was from a third party), tag names to later identify colors associated with a particular place or object for example, or even the associated image file name for color sets exclusively used on a specific painting. I have created an alias in the Finder to an Automator application which will allow Spotlight Comments to be added to an item or items selected in the Finder search results window - download link is below;
add_comment_folder.dmg.gz (84 KB)
Note that if Spotlight comments are added while the Finder results window remains open, then it will be necessary to click the refresh button, bottom right of the Finder window for the newly associated comments to be displayed. The full text contents of individual comments may be displayed by placing the cursor over the short comments text in the Finder results window. A floating text box will appear after a few moments.
Finding Specific RGB Values in Color Set Documents
This almost works in Tiger Spotlight searches, but I have not been able to find a way of searching only for the value combinations as a complete string on the same line in the Color set document. In the above ‘Gray Range’ example, spaces between the search words/numbers are treated as AND operators, so provided all three RGB values are present anywhere in the document (say R: 059 on one line, G:059 on another line, and B:073 on yet another different line), then the document would still appear in the search results. To further compound this problem, the space immediately before the first number of the R value and the ‘:’ separators are effectively treated as AND operators, thus the associated number strings could be present in either the R,G or B columns of the search results. As each color swatch is written on its own line in the Color Set document, then such searches are of limited use to us, due to the potential number of matches returned.
An application called SpotInside uses a scoring system in the search, giving documents matching only 1 of the possible 3 RGB values the lowest score, and the highest scores to documents satisfying the complete search string (which are automatically highlighted);

SpeedSearch X performs string searches admirably, although currently does not appear to search associated Spotlight Comments;

File Association
Unless the Color Set files were saved as plain text documents (normally opening in TextEdit when their respective icon is double clicked), Painter Color Set files will attempt to open in whichever Painter version they were created and saved in. To have these latter files open in either BBEdit or TextEdit, I have also included aliases to these applications in the Finder. It is then a simple matter of dragging and dropping a Color Set icon from the Finder results window onto one of the text application’s alias icons in the Finder in order to have the document opened in that application.
Boolean Searches
Boolean searching in Tiger’s Spotlight is not fully implemented. It appears that AND (a space between the numbers or words) is the only operator available to search Spotlight comments. Text document content may also be searched using the equivalent to OR, and by using an exclusion operator.
Blue Yellow finds content or Spotlight comments containing Blue AND Yellow.
Blue|Yellow finds content containing Blue OR Yellow, but not necessarily both in the same document.
Blue(-Yellow) finds content containing Blue but EXCLUDING Yellow.
From what I hear, Leopard’s Spotlight search implementation will be more comprehensive.
brush





BrushTalk