如何在新选项卡 (Mavericks) 中复制当前打开的 Finder 视图?

如何在新选项卡 (Mavericks) 中复制当前打开的 Finder 视图?

在此论坛的一个主题中,有一个有趣的解决方案,关于如何借助 AppleScript 打开已打开的 Finder 窗口的副本: 如何复制当前打开的 Finder 视图?

借助 OS X 10.9 Mavericks 中新的选项卡式 Finder,我想知道是否有办法实现 AppleScript,在新的 Finder 选项卡而不是新的 Finder 窗口中打开重复项?有人成功找到解决方案了吗?

答案1

Finder 的词典不支持制表符,但你可以模拟按下 command-T:

tell application "Finder"
    activate
    set t to target of Finder window 1
    set toolbar visible of window 1 to true
end tell
tell application "System Events"
    keystroke "t" using command down
end tell
tell application "Finder"
    set target of Finder window 1 to t
end tell

Finder 窗口的目标是标题栏上显示的文件夹,它不依赖于列表视图中选择了哪些项目。

答案2

您可以按以下方式进行操作:

命令+ctrl+O

在任何文件夹上它都会显示在新选项卡中。

答案3

在以前的 MacOS 版本(Monterey 之前)中 - Cmd+ Ctrl+ O- 运行完美……你甚至可以Cmd+双击在 Finder 路径栏中的文件夹上,在该位置打开一个新窗口。或者,如果您启用了 Finder > 偏好设置 > 常规“在选项卡中打开文件夹而不是在新窗口中打开文件夹”,Cmd+双击路径栏上的文件夹将在新选项卡中打开该位置。

然而,在蒙特雷之后,这些选项似乎不再有效。你仍然可以(乏味地)右键单击文件夹并选择“在新窗口中打开”或“在新选项卡中打开”,但快捷方式Cmd+ Ctrl+OCmd+双击不再起作用(即使您可以在菜单选项中看到它)。

这个 MacRumors 论坛是我能找到的唯一讨论此消息的地方:https://forums.macrumors.com/threads/cmd-double-click-on-finder-path-bar-doesnt-open-folder-in-new-window.2331090/


测试的版本:Monterey 12.5.1(在 Intel 上)、12.1(在 Apple Silicon 上)、Big Sur 11.6.2、Catalina 10.15.7……

答案4

这是@n8henrie 的解决方案,除了对重新选择选定项目进行调整外,我有点喜欢:

-- duplicateFinderTab.scpt
-- Uses a hacky workaroud to duplicate the frontmost Finder tab,
-- since Apple hasn't provided great AppleScript support for this.

----------------------------------------------
on run {}
    tell application "Finder"
        if (count of Finder windows) > 0 then set duplicate_me to target of front Finder window
        set _sel to the selection
    end tell

    -- Short delay may or may not be necessary, mine seems to work without.
    -- delay 0.2

    new_tab()

    tell application "Finder"
        set target of front Finder window to duplicate_me
        select _sel
    end tell
end run

----------------------------------------------
on new_tab()
    tell application "System Events" to tell application process "Finder"
        set frontmost to true
        tell front menu bar to tell menu "File" to tell menu item "New Tab"
            perform action "AXPress"
        end tell
    end tell
end new_tab

相关内容