Mai 31, 2005

Thunderbird-Tray

Kategorie: X-Brotkrümel — Richard @ 10:47 pm

Mac OS X: What Are All Those Processes?

Kategorie: X-Brotkrümel — Richard @ 9:22 pm
Mai 30, 2005

DisableTigerFeatures

Kategorie: X-Brotkrümel — Richard @ 7:50 am

blog log

Kategorie: X-Brotkrümel — Richard @ 12:16 am
Mai 29, 2005

Spotlight OR query

Kategorie: Kurz notiert — Richard @ 5:37 pm

richard.heider.de 0.01 ¢ logo Unchaining the Tiger in Spotlight does not come easy. If you try to construct complex queries in OS X Tiger you are currently tamed by the capabilites of the GUI. More to the point: Its hard to find a way in the Spotlight Windows, Finder Search or Automator to construct a query consisting not just of “AND”, but of OR, NOT, brackets, wildcards, etc. This is obviously a limitation of the current GUI not of the spotlight engine, as my workaround will show.

My goal was to create a smart folder containg all my newspaper clippings, which I scan into PDF documents. The names of these documents start with SZ, MM or WS, depending on which newspaper the clipping is from.

However it is relativly easy to constuct a query for PDF Documents whose Name starts with SZ. This query can then be saved to an smart folder document. Now these smart folders are actually just XML files containing a query, which is run whenever you open that folder. If you open this .savedSearch document you see one XML object named string:

<string>(kMDItemContentTypeTree = 'com.adobe.pdf') && (kMDItemDisplayName = 'SZ*'cd) && (kMDItemContentType != com.apple.mail.emlx) && (kMDItemContentType != public.vcard)</string>

(Because the ampersand is a reserved character in XML “&&” is actually displayed in the file as ” &amp; &amp;” but i will use the “&&” for better readability here.)

Now this phrase within the string tags is the actual query and it can be edited. Now this new version using () and OR (= “||”) does exactly what i want:
<string>(kMDItemContentTypeTree = 'com.adobe.pdf') && ((kMDItemDisplayName = 'SZ*'cd) || (kMDItemDisplayName = 'MM*'cd) || (kMDItemDisplayName = 'WS*'cd)) && (kMDItemContentType != com.apple.mail.emlx) && (kMDItemContentType != public.vcard)</string>

The syntax of the search query is similar to “C” and also used by the command line tool for spotlight searches, mdfind:
mdfind "(kMDItemContentTypeTree = 'com.adobe.pdf') && ((kMDItemDisplayName = 'SZ*'cd) || (kMDItemDisplayName = 'MM*'cd) || (kMDItemDisplayName = 'WS*'cd))

The conditions (kMDItemContentType != com.apple.mail.emlx) && (kMDItemContentType != public.vcard)" are just there to exclude the Apple Mail Mailbox files and *.vcf address cards

During my research I found these additional references:

We know that a space implies “AND”, but it is a “least precedence AND”. Using most other punctuation (”+ “and “,” both work, for example) acts as a “high precedence AND”. The “|” (pipe) character is an “OR”. Finally, “(-token)” seems to act as an excluder, which isn’t quite a NOT, but close enough. It has to be immediately after another keyword with no space. The different precedence ANDs are nice.

So, “xmas|christmas bob|robert” is ((xmas OR christmas) AND (bob OR robert)) and “jack+jill|hansel+gretel” is ((jack AND jill) OR (hansel AND gretel)). The exclusion operator doesn’t seem to combine with others except as a final exclusion step, but something like “foo+bar|baz(-quux)” works as “(((foo AND bar) OR baz) AND NOT quux)”. As noted on the tips page, putting a phrase in double quotes looks for that phrase, but it doesn’t seem the most consistent; that phrase appearing in text files, for example, will not show up. Finally, prefixing the whole query with a single quote has some effect, but what exactly that is isn’t obvious: it seems to exclude any image search results and according to macosxhints, it doesn’t search deleted text in Word files, for example. [Source: Matthew Gray's Weblog]

Update:

Speicher Kaufen - Online Shops

Kategorie: X-Brotkrümel — Richard @ 9:05 am
Mai 28, 2005

OS X Dashboard widget

Kategorie: X-Brotkrümel — Richard @ 3:33 pm

Music industry in China

Kategorie: X-Brotkrümel — Richard @ 3:30 pm

For ÜberGeeks only

Kategorie: X-Brotkrümel — Richard @ 3:28 pm

blog log

Kategorie: X-Brotkrümel — Richard @ 3:09 pm
  • post[next].com