script to toggle cursor size

Hello everyone, I’m new to this forum, and pretty new to AppleScript.

I am a landscape photographer, and I use both Adobe Lightroom and Photoshop for my post-production work, working on 2- 27" monitors. Due to the monitor size, for every app but the 2 Adobe apps, I enlarge my cursor for better visibility. But that creates problems in LR and PS when using brushes – the brush size is shown enlarged by the same amount as the cursor, but the actual brush size is much smaller. Makes fine adjustment a pain.

I have been using the following script in Automator. It works fine, but each time I hit the keyboard shortcut it opens Automator and I have to manually run it. How would I make this run just with a keyboard shortcut?

tell application “System Preferences”

set current pane to pane ""

tell application "System Events"
	repeat until slider "Cursor size:" of window "Accessibility" of process "System Preferences" exists
	end repeat
	set theSlider to slider "Cursor size:" of window "Accessibility" of application process "System Preferences"
	set stash to value of theSlider
	if value of theSlider is 1.0 then
		set value of theSlider to 2.5
		set value of theSlider to 1.0
	end if
end tell

end tell

Browser: Safari 604.5.6
Operating System: Mac OS X (10.12.5)

Hi. Welcome to MacScripter.

Is your Automator workflow saved as an application? It should run without opening Automator if it is. You can either click the “Application” icon when creating a new workflow, or choose “Application” in the “File format:” pop-up menu when you save it.

Or if the script’s the only thing in the workflow, you could save it as an application instead, from Script Editor.

Thanks for the input Nigel. I saved it as an application, but when i double click it I get a message:
“The action “Run AppleScript” encountered an error.”