Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/macos/10.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Macos 单击Finder中的任意位置时,是否应用脚本在**当前**文件夹中打开终端?_Macos_Applescript_Osx Elcapitan_Automator_Finder - Fatal编程技术网

Macos 单击Finder中的任意位置时,是否应用脚本在**当前**文件夹中打开终端?

Macos 单击Finder中的任意位置时,是否应用脚本在**当前**文件夹中打开终端?,macos,applescript,osx-elcapitan,automator,finder,Macos,Applescript,Osx Elcapitan,Automator,Finder,当我右键单击Finder中的文件夹时,我已经有了文件夹服务中的新终端 现在,我还希望能够右键单击Finder窗口中的任何位置(即文件和文件夹周围的空白),并在此处选择新终端 我现在有以下自动程序脚本(runapplescript,在Finder中无输入): tell application "Finder" set this_folder to (folder of the front Finder window) as alias end tell tell application

当我右键单击Finder中的文件夹时,我已经有了文件夹服务中的新终端

现在,我还希望能够右键单击Finder窗口中的任何位置(即文件和文件夹周围的空白),并在此处选择新终端

我现在有以下自动程序脚本(
runapplescript
,在
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
当我右键单击文件夹时,它会在我所处的文件夹(不是我右键单击的文件夹)中打开一个新的终端窗口

现在,右键单击空白(或者至少在文件和文件夹上)时,是否可以让此服务出现

编辑


我刚刚发现它可以放在Finder工具栏中,并且完全满足我的需要。但是,了解是否可以使用服务实现仍然很有意思。

普通AppleScript无法检测鼠标事件,自动程序服务需要指定的
输入显示在服务上下文菜单中。要获取所选文件夹的父文件夹,请写入
,将此\u文件夹设置为(front Finder窗口的文件夹容器)作为别名。我更喜欢工具栏的方式。