fix adium spotlight log search

For Adium 1.4.2, the chat transcript log doesn’t appear in spotlight search result even though the word is exactly in the chat logs. Yeah, it’s no big deal, but a bit annoyance, especially when Adium’s own transcript search won’t return good results.

After some research, a few tryouts were taken: Using mdimport to force spotlight reindex the logs folder seems not work. Followed instruction of this ticket to move the chat logs folder to user documents folder, still not work. Then, this ticket has the culprit bug revealed. The
GetMetadataForXMLLog function doesn’t handle the chatlog bundle correctly. Just appending the xml path before parsing the xml file and rebuilding the project will exactly fix the spotlight search issue.

Therefore the reverse steps are the final solution:
1) Get my bug fixed version of AdiumSpotlightImporter (or compile the bugfix version by yourself), unzip and copy to /Applications/Adium.app/Contents/Library/Spotlight, and make sure the importer is used by spotlight in “mdimport -L”
2) Move the adium chat log folder to your documents folder as the above ticket shows, so that spotlight will not exclude it under the system library folder
3) mdimport “your new adium chat log folder” to merge into the spotlight index
4) Search words in spotlight, the adium result now will show in search results under the mail category

Good luck, Adium users!

Rar archive in mac finder with automator

用Mac的一个重要麻烦就是zip archive经常在windows下乱码,由于mac采用unicode编码,中文文件名zip压缩文件之后,在采用ansi编码格式的windows上就是乱码,往往无法解压还原。用stuffit,finder自带的压缩,都避免不了这个问题。

但rar文件就没有乱码问题,用betterzip之类的就可以归档rar文件,但大多需要打开betterzip程序,再选择文件等,多了好几个步骤,如何能在finder里选择目标文件直接生成rar文件?当然可以,用mac著名的automator!

在automator里,选择Service服务类型,选择接受文件和目录,然后拖进执行shell脚本,选择输入自变量,然后在脚本内容里输入:

#!/bin/bash
for f in “[email protected]
do
pp=`dirname “$f”`
ff=`basename “$f”`
cd “$pp”
/usr/local/bin/rar a -m5 -ep1 -o+ Archive.rar “$ff”
done

保存为建立rar的工作流服务,这样在finder选择多个文件或目录后,右键选择服务里直接可以把目标文件生成rar归档文件了。