I wanted to find a way how to disable/enable hot corners via keyboard shortcut. I found this apple script
property theSavedValues : {"Mission Control", "Desktop", "Dashboard", "Launchpad"} -- for example
tell application "System Preferences"
set current pane to pane id "com.apple.preference.expose"
tell application "System Events"
tell window "Mission Control" of process "System Preferences"
click button "Hot Corners…"
tell sheet 1
tell group 1
set theCurrentValues to value of pop up buttons
if theCurrentValues is {"-", "-", "-", "-"} then
repeat with i from 1 to 4
set thisValue to item i of theSavedValues
tell pop up button i
click
click menu item thisValue of menu 1
end tell
end repeat
else
copy theCurrentValues to theSavedValues
repeat with i from 1 to 4
tell pop up button i
click
click last menu item of menu 1
end tell
end repeat
end if
end tell
click button "OK"
end tell
end tell
end tell
quit
end tell
So I created an service in Automator with this apple script, attached it to keyboard shortcut, whenever I run this script in automator, it works but when i hit the shortcut, im getting "The action "Run AppleScript" encountered an error ". Any ideas what can be done to fix this? Thank you
Oh my god I feel so dumb, the only thing needed was to grant accessibility permission to app from which I'm using this service :).
You can do this by going to (Mac OS)Settings -> Security&Privacy -> Accessibility -> and finding the app from which you are running the service. (In my case it's Finder.)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With