使用 Applescript 设置 MacOS Mission Control 的快捷方式

问题描述 投票:0回答:1

我习惯于通过中键单击(鼠标 3)显示 MacOS Mission Control 窗口,但 MacOS Sequoia 15.1 和 15.2 不会使用鼠标“桌面和 Dock > Mission Control > 快捷方式”保存 Mission Control 显示设置。每次启动时,设置都会丢失并恢复为默认值。

我在这里要求使用 shell 命令默认写入解决方法,但似乎没有人有答案: 使用默认的 write shell 命令设置 MacOS Mission Control 的快捷方式?

有没有办法用完整的 Applescript 来做到这一点? 此时,我可以打开“快捷方式”对话框窗口: 将 paneID 设置为“com.apple.Desktop-Settings.extension”

tell application "System Settings"
    activate
    delay 0.7
    set the current pane to pane id paneID
    delay 0.7
    reveal anchor "Shortcuts" of pane id paneID
    delay 0.7
    
end tell

我不知道如何修改第二个弹出菜单(鼠标快捷键)。

applescript macos-sequoia
1个回答
0
投票

这就是我所做的:有点混乱,可能可以优化,但它对我有用。

use AppleScript version "2.4" -- Yosemite (10.10) or later
use scripting additions

----------------------------------------------------------------------
set paneID to "com.apple.Desktop-Settings.extension"
set dlogTitle to "Raccourcis Mission Control"
set popupMenuName to "Raccourci souris" -- ///// localization
set popupMenuItem to " Bouton de souris 3" -- ///// localization

----------------------------------------------------------------------
tell application "System Settings"
    ------------------------ open System Settings/Bureau et Dock
    activate
    delay 0.7
    set the current pane to pane id paneID
    delay 0.7
    ------------------------ open panneau "Raccourcis"
    reveal anchor "Shortcuts" of pane id paneID
    delay 0.7
    ------------------------ click menu local
    try
        tell application "System Events"
            tell pop up button popupMenuName of group 1 of scroll area 1 of group 1 of sheet 1 of window 1 of application process "System Settings"
                click
                delay 0.2
                click menu item popupMenuItem of menu 1
            end tell
            delay 0.5
            
            ------------------------ close panneau
            click button 1 of group 1 of sheet 1 of window 1 of application process "System Settings"
            delay 0.8
            ------------------------ close System Settings
            tell application "System Settings" to quit
        end tell
    on error errMsg number errNum
        display dialog errMsg as text buttons {"Annuler"} default button 1 with title dlogTitle with icon 0
    end try
end tell
© www.soinside.com 2019 - 2024. All rights reserved.