V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
sunrisewestern
V2EX  ›  macOS

macos 13 Ventura applescript 快速切换 f1 , f2, f3... 键功能

  •  
  •   sunrisewestern · 2022-12-22 04:39:53 +08:00 · 1294 次点击
    这是一个创建于 463 天前的主题,其中的信息可能已经有所发展或是发生改变。

    之前用的别人提供的 applescript 代码

    tell application "System Preferences"
    	set current pane to pane "com.apple.preference.keyboard"
    end tell
    
    tell application process "System Preferences"
    	repeat until exists tab group 1 of window "Keyboard"
    	delay 0.5
    	end repeat
    	click radio button "Keyboard" of tab group 1 of window "Keyboard"
    	try
    		click checkbox "Use F1, F2, etc. keys as standard function keys on external keyboards" of tab group 1 of window "Keyboard"
    	end try
    	try
                    click checkbox "Use F1, F2, etc. keys as standard function keys" of tab group 1 of window "Keyboard"
            end try
    end tell
    tell application "System Preferences" to quit
    

    但 macos 13 设置里这个选项的位置变了,之前的不能用了,有大佬知道怎么改吗

    7 条回复    2022-12-28 13:13:29 +08:00
    Quanuanc
        1
    Quanuanc  
       2022-12-22 09:26:33 +08:00   ❤️ 1
    如果你的系统语言是英文的,可以试试这个: https://www.icloud.com/shortcuts/ba6118a07c80470c934c52c95d29117e ,从这个帖子 https://www.reddit.com/r/shortcuts/comments/w8tnqa/automatic_fn_toggle_shortcut_for_mac_os_x_ventura/来的。
    如果你的系统语言是中文的,修改一下上面的脚本也能用,这是我修改的版本: https://www.icloud.com/shortcuts/7dde5bdd6c1e4c0dbd284d8cd7bb4660
    Volekingsg
        2
    Volekingsg  
       2022-12-22 09:29:02 +08:00
    defaults write NSGlobalDomain com.apple.keyboard.fnState -bool true/false
    shervy
        3
    shervy  
       2022-12-22 11:25:48 +08:00
    非程序员完全看不懂。
    sunrisewestern
        4
    sunrisewestern  
    OP
       2022-12-22 22:52:14 +08:00
    @Quanuanc 虽然会弹出设置界面,但可以用,感谢
    sunrisewestern
        5
    sunrisewestern  
    OP
       2022-12-22 22:54:10 +08:00
    @Volekingsg 改这个 plist 好像不会立即生效
    Volekingsg
        6
    Volekingsg  
       2022-12-23 15:11:59 +08:00
    @sunrisewestern #5 确实,事前事后 kill 一些东西都没用,也不确定是不是我没找对
    ooops
        7
    ooops  
       2022-12-28 13:13:29 +08:00 via iPhone
    不如 karabiner 重新映射一套了
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   5240 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 37ms · UTC 09:17 · PVG 17:17 · LAX 02:17 · JFK 05:17
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.