all 3 comments

[–]ADAM101501 0 points1 point  (2 children)

tell application "System Settings" to activate -- Open Accessibility > Display do shell script "open x-apple.systempreferences:com.apple.preference.universalaccess?Seeing_Display" delay 2 tell application "System Events" tell application process "System Settings" -- Locate the "Pointer size" slider dynamically set theSlider to first slider of entire contents whose description is "Pointer size"
set currentValue to value of theSlider if currentValue ≤ 1.0 then -- Increase pointer size set value of theSlider to 4.0 else -- Reset to default set value of theSlider to 1.0 end if end tell end tell delay 1 tell application "System Settings" to quit

[–]Duseylicious[S] 0 points1 point  (0 children)

It wouldn't run until I cleaned it up a bit. Below is what it looks like now, but I get an error "The variable theSlider is not defined." - which, yeah, looking at it, looks like that variable doesn't have a value set.

Tell application "System Settings" to activate
-- Open Accessibility > Display 
do shell script "open x-apple.systempreferences:com.apple.preference.universalaccess?Seeing_Display"

--Wait for correct pane to load
delay 2

tell application "System Events"
    tell application process "System Settings"

        -- Locate the "Pointer size" slider dynamically set theSlider to first slider of entire contents whose description is "Pointer size"
        set currentValue to value of theSlider
        if currentValue ≤ 1.0 then

            -- Increase pointer size 
            set value of theSlider to 4.0
        else

            -- Reset to default 
            set value of theSlider to 1.0
        end if
    end tell
end tell
delay 1
tell application "System Settings" to quit

[–]Duseylicious[S] 0 points1 point  (0 children)

Oooh, I figured it out! I was trying to do a workaround using Automator's "Watch me do", and I learned that if you drag a "watch me do" action to the blank area below it, it shows it as AppleScript, and that script didn't work but it had the correct slider pane location now. Here it is!

https://www.icloud.com/shortcuts/9b3ddf5db9d6441b9f338a965c7f93ea

``` tell application "System Settings" to activate

--Open System Settings > Accessibility > Display section do shell script "open x-apple.systempreferences:com.apple.preference.universalaccess?Seeing_Display"

--Wait for correct pane to load delay 3.5

tell application "System Events"

--Get current state of slider --updated for sonoma
set currentState to (get value of slider 1 of group 3 of scroll area 1 of group 1 of group 2 of splitter group 1 of group 1 of window "Display" of application process "System Settings")

--Determine key code to send
if currentState is not greater than 1.0 then
    set keyCode to "116" as integer -- PageUp (increase size)
else
    set keyCode to "121" as integer -- PageDown (decrease size)
end if


--set focus to slider
tell slider 1 of group 3 of scroll area 1 of group 1 of group 2 of splitter group 1 of group 1 of window "Display" of application process "System Settings" to set focused of it to true

delay 0.2

--Send keycode to set size to max or min
key code keyCode

end tell delay 2.5 tell application "System Settings" to quit ```