ninehills / blog

https://ninehills.tech
747 stars 65 forks source link

MacOS 在 Finder 中增加复制文件路径的快捷方式 #81

Closed ninehills closed 1 year ago

ninehills commented 4 years ago

背景:需要将文件路径URL,如 file:///Users/cynic/controlconfig.conf 快速复制,然后粘贴到笔记中作为URL,以方便点击后,快速定位文件。

解决方案:网络上基本使用 Automator,也就是“自动操作“,但是只能复制/Users/cynic/controlconfig.conf格式的路径。需要自己增加AppleScript实现。

实现方法:

image

其中 AppleScript 内容为

on run {input, parameters}
    return "file://" & POSIX path of input
end run