如何使用AppleScript调整光标大小?

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

我们可以在系统偏好设置->辅助功能->显示中调整光标大小。如何使用 AppleScript 做到这一点?也许

do shell script "...."
tell application "System Preferences"

macos shell cursor
3个回答
1
投票

我有一个在 Catalina 之前使用的脚本,该脚本不再工作,不幸的是我似乎找不到原始版本,但现在我针对系统偏好设置的新布局修复了它,我可以分享更新的版本:

tell application "System Preferences"
    reveal anchor "Seeing_Cursor" of pane id "com.apple.preference.universalaccess"
    delay 0.2
    
    tell application "System Events"
        set contentView to tab group 1 of group 1 of window "Accessibility" of application process "System Preferences"
        set theSlider to slider "Cursor size:" of contentView
        
        set stash to value of theSlider
        if value of theSlider is 1.0 then
            set value of theSlider to 4.0
            say "Big Mouse" using "Pipe Organ"
        else
            set value of theSlider to 1.0
            say "Tiny Mouse" using "Zarvox"
        end if
        stash
    end tell
end tell

请原谅我的声音……这是我自己的娱乐。 这些片段非常适合我的自定义触摸栏按钮


0
投票

https://github.com/alexzielenski/Mousecape/releases。它是一个开源应用程序,允许为 Mac OS X 10.8-10.10 自定义光标。它可以导入旧的 MightyMouse 文件,或者您可以创建自己的“斗篷”。该页面包含一个下载 Max Rudberg 的 Svanslös 光标重制版的链接。

如果问题是您很难在终端屏幕上找到光标,那么 在 Mac OSX 上按住 alt 键会将光标更改为带有白色边框的黑色十字,这比默认文本栏更容易识别。

祝你好运!


0
投票

这是@ll_cool_aid答案的更新版本,适用于Sequoia 15.0.1。
它是双向的,如果光标很小,它就会变大;如果光标很小,它就会变大。如果它很大,它就会变小。 不幸的是,我还没有找到一种方法可以在不操作“设置”应用程序的 GUI 的情况下执行此操作。

tell application "System Settings"
    activate
    reveal anchor "AX_CURSOR_SIZE" of pane id "com.apple.Accessibility-Settings.extension" of application "System Settings"
end tell

tell application "System Events"
    tell process "System Settings"
        -- Wait until the slider is available
        repeat until slider "Pointer size" of group 3 of scroll area 1 of group 1 of group 2 of splitter group 1 of group 1 of window 1 exists
            delay 0
        end repeat
        
        set pointerSettings to group 3 of scroll area 1 of group 1 of group 2 of splitter group 1 of group 1 of window 1
        set pointerSizeSlider to slider "Pointer size" of pointerSettings
        
        if value of pointerSizeSlider is 4 then
            repeat until value of pointerSizeSlider is 1
                decrement pointerSizeSlider
            end repeat
        else
            repeat until value of pointerSizeSlider is 4
                increment pointerSizeSlider
            end repeat
        end if
    end tell
end tell
© www.soinside.com 2019 - 2024. All rights reserved.