YouTube のひととブラクラのひとがほしがってたので書いてみた。
on run argv
tell application "Finder"
set comment of ((POSIX file (item 1 of argv)) as file) to (item 2 of argv)
end tell
end run
こんなんを a.scpt とか保存して、
% osascript a.scpt file.txt 'hello world'
でコメントがつけられます。AppleScript はよくわからないので引数に複数ファイルとかは無し。
Spotlight のメタデータを勝手にいじるには、ヘチマ_BLOG : MDItemSetAttribute(s) が使えるはずなんだけど、なぜか MDItemSetAttributes から kMDItemFinderComment をいじると Finder に反映されないので、AppleScript を使ってみた。
Perl 書けるなら Chris Nandor / Mac-Glue - search.cpan.org とかも良さげ。