goo blog サービス終了のお知らせ 

GameSprit

自転車やMac・AppleScript、映画・小説やドラマのレビュー、備忘メモ・クイズなどを置いています。

AppleScript:ファイルへのパスをクリップボードにコピー

2008-09-28 06:31:45 | AppleScript
Copy the Path of a File to the Clipboard » Help Your Mac!

ファイルを選択し、そのファイルへのパスをクリップボードにコピーする AppleScript が紹介します。


tell application “Finder”
set sel to the selection as text
set the clipboard to POSIX path of sel
end tell

結果は例えば『/Users/****/Desktop/googleChartAPI.html』とか。



Automator の contextual menu(右クリックメニュー)に登録する方法。

If you prefer, you can also easily make this AppleScript a Finder contextual menu plug-in. Launch Automator, create a blank workflow, and then drag the Automator -> Run AppleScript (Utilities -> Run AppleScript in 10.5) action to the work area. Replace the stock AppleScript text with the script you see above, then choose File -> Save as Plug-in. In the new window that appears, give your plug-in a name (Copy Path to Clipboard), set the Plug-in For pop-up to Finder, and click Save.





最新の画像もっと見る

post a comment

サービス終了に伴い、10月1日にコメント投稿機能を終了させていただく予定です。
ブログ作成者から承認されるまでコメントは反映されません。