【发布时间】:2016-08-12 23:59:29
【问题描述】:
当我右键单击 Finder 中的文件夹时,我已经拥有 New Terminal at Folder 服务。
现在我还希望能够在 Finder 窗口(即文件和文件夹周围的空白处)中右键单击 anywhere,并选择New Terminal here。
我现在有以下 Automator 脚本(Run AppleScript 和 no input 中的 Finder):
tell application "Finder"
set this_folder to (folder of the front Finder window) as alias
end tell
tell application "Terminal"
activate
do script "cd \"" & (POSIX path of (this_folder as string)) & "\""
end tell
这在我右键单击文件夹时有效 - 它会在我所在的文件夹中打开一个新的终端窗口(不是我右键单击的那个)。
现在,是否可以在右键单击空白处(或至少在文件和文件夹上)时显示此服务?
编辑
我刚刚找到了this app,它可以放置在 Finder 工具栏中,并且完全符合我的需要。但是,知道是否可以使用服务来实现仍然很有趣。
【问题讨论】:
-
普通 AppleScript 无法检测鼠标事件,Automator 服务需要指定的
Input才能出现在服务上下文菜单中。要获取所选文件夹的父文件夹,请写入set this_folder to (container of folder of the front Finder window) as alias。我更喜欢工具栏的方式。
标签: macos applescript osx-elcapitan automator finder