ダウンロード先をSpotlightコメントに入力してくれるApple Script
Safariでダウンロードしたファイルのダウンロード先をSpotlightコメントに入力してくれるプラグインとして、DownloadComment(リンク先はMacUpdate)がありますが、環境によってはSafari5で使えない上に開発も終わってしまったようです。
その代わりになるApple ScriptがTip: Automatically Add URL To A Downloaded File As Spotlight Commentに載っていたので、紹介しようと思います。
- 以下のコードをスクリプトエディタにコピペします。
on adding folder items to thisFolder after receiving someItems if (count items of someItems) ≠ 1 then return set itemAlias to (item 1 of someItems) as alias do shell script "mdls " & (quoted form of (POSIX path of itemAlias)) set urls to the result set oldDelimiters to AppleScript's text item delimiters set AppleScript's text item delimiters to {"kMDItemWhereFroms"} try set urls to (text item 2 of urls) set AppleScript's text item delimiters to {quote} if (count urls's text items) ≤ 3 then set urls to (text item 2 of urls) else set urls to (text item 4 of urls) end if set myFile to itemAlias as string tell application "Finder" set the comment of file myFile to urls end tell on error set AppleScript's text item delimiters to oldDelimiters return -- urls don't exist end try end adding folder items to - 適当な名前を付け(ex. Add Spotlight Comment with URL)、ユーザフォルダのLibrary/Scripts/Folder Action Scripts/以下に保存します。


- フォルダアクションでダウンロードフォルダにスクリプトを設定します。

これでダウンロードしたファイルのSpotlightコメントにダウンロード先が入力されます。

DownloadCommentと違って正確なダウンロード先とはいかないみたいですが、DownloadCommentが動かない方には便利なスクリプトではないでしょうか。
さっそく設定してみました。
とても便利ですね、情報ありがとうございます!
ユーザーのライブラリに該当フォルダが無かったのでフォルダを作成してスクリプトを保存したのですが、フォルダ名の最後に「s」が入ってないと認識してくれませんでした。 「Folder Action Scripts」←
ぴろ
2010.11.03 3:29 pm
コメントありがとうございます。
情報ありがとうございました。
教えていただいた点を修正しました。
pinacol
2010.11.03 5:47 pm