LoginSignup
0
0

More than 5 years have passed since last update.

カーソルサイズをトグルするAppleScript

Last updated at Posted at 2016-07-16

動作するけど汚い…

tell application "System Preferences"
    set current pane to pane "com.apple.preference.universalaccess"

    tell application "System Events"
        repeat until application process "System Preferences" is not (exists)
        end repeat
        delay 0.5
        tell first window of process "System Preferences"
            tell table 1 of scroll area 1
                set selected of row 2 to true
            end tell
            repeat until slider "カーソルのサイズ:" exists
            end repeat

            set theSlider to slider "カーソルのサイズ:"
            set stash to value of theSlider
            if value of theSlider is 1.0 then
                set value of theSlider to 4
            else
                set value of theSlider to 1.0
            end if
            stash
        end tell
    end tell
    quit
end tell

20160716時点でうまく動かない…repeat入っているので使用には注意。

カーソルサイズを最小=最大でトグル。
Maestroなどでショートカットキーを当てて使用

tell application "System Preferences"   
    set current pane to pane "com.apple.preference.universalaccess"
end tell
tell application "System Events"
    tell first window of process "System Preferences"
        repeat until slider "カーソルのサイズ:" exists
        end repeat
        tell table 1 of scroll area 1
            set selected of row 2 to true
        end tell
        set theSlider to slider "カーソルのサイズ:"       
        set stash to value of theSlider
        if value of theSlider is 1.0 then
            set value of theSlider to 4
        else
            set value of theSlider to 1.0
        end if
        stash
    end tell
end tell
tell application "System Preferences" to quit

問題点

アクセシビリティパネルで「キャプション」を選択している(していた)と、ディスプレイへ自動で移動できない。

コードをお借りした&参考にしたページ

『画面のグレー/カラーのスイッチ』
http://goozenlab.com/blog/2013/02/grayscale-switch/

『mouse - How can I easily toggle the cursor size back and forth between normal and largest? - Ask Different』
http://apple.stackexchange.com/questions/88267/how-can-i-easily-toggle-the-cursor-size-back-and-forth-between-normal-and-larges

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0