3

I used a downloaded applescript to fast enable/disable hot corners but they don't work after I upgrade to Mavericks. Someone knows what's happening?

Here's the disable script, hope it'll help you know what I'm talking about.

tell application "System Events"
    activate
    if UI elements enabled then
        tell expose preferences
            set properties of the top left screen corner to {activity:none, modifiers:{}}
            set properties of the top right screen corner to {activity:none, modifiers:{}}
            set properties of the bottom left screen corner to {activity:none, modifiers:{}}
            set properties of the bottom right screen corner to {activity:none, modifiers:{}}
        end tell
    else
        tell application "System Preferences"
            activate
            set current pane to pane "com.apple.preference.universalaccess"
            display dialog "UI element scripting is not enabled. Check \"Enable access for assistive devices\""
        end tell
    end if
end tell

tell application "System Preferences" to quit
2

A solution was posted at https://discussions.apple.com/message/23989931:

property theSavedValues : {"Mission Control", "Desktop", "Dashboard", "Launchpad"} -- for example

tell application "System Preferences"
    activate
    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
3
  • WTF it changes again in Yosemite... – can. Oct 19 '14 at 16:25
  • Also see github.com/hekevintran/HotCornerSaver. This one is written for Mavericks and should work on Yosemite. – hekevintran Jan 12 '15 at 20:05
  • Confirmed that this script works in Mojave. Sometimes it results in an "Can’t get window "Mission Control" of «class prcs» "System Preferences" of application "System Events"." error, but running it again works. – Calion Dec 11 '18 at 18:30
2

Before Mavericks there was indeed a property in System Events called "Expose preference".

Since 10.7 Lion, Expose was replaced by Mission Control, so this must be a remaining of this past time (The pref pane is called Expose.prefPane).

But in Mavericks this property was removed and not replaced.

tell application "System Events" to get properties returns

  • security preferences
  • network preferences
  • screen saver preferences
  • appearance preferences
  • CD and DVD preferences
  • dock preferences

And none of them has access to the hot corner properties.

So, no it's currently not possible to do the same thing. Or to be more precise, to do it without UI scripting. (BTW your script does not use UI scripting features).

0

I was also searching for an answer to this question and finally got very angry with the Apple developers. As I discovered the scripting support for some of the preference panes is gone. However, I discovered this link

Just use the favourite key method

which I find quite a good solution. This does not solve your problem with scripting, I know, but I would argue that this is even the more elegant solution, because the best line of code is the one that was never written, or something.

I can live with this solution, I hope some others can as well.

I post the solution here as well, because I am always angry when I find some solution that works and the link is broken: (This solution is stolen from LexFriedman at http://hints.macworld.com/article.php?story=20130621130534978)

But anyone who uses Hot Corners (which OS X refers to interchangeably as Active Screen Corners) triggers those mouse-controlled shortcuts accidentally sometimes. The solution is this: When you're choosing a Hot Corner setting from one of the drop-down menus, hold down your preferred modifier key or keys. You'll see the options change from, say, Mission Control to Option Mission Control" instead.

From then on, your corner will only work when you're also holding down the modifier key(s) you specified. Now, trips to the Apple menu won't trigger your Hot Corner shortcut—unless you're pressing your selected modifier key, too.

3
  • 1
    This counts as a workaround, but not as convenient. – can. Nov 28 '13 at 6:52
  • I provided the answer here: But anyone who uses Hot Corners (which OS X refers to.... and set the link. I do not understand the remark. I thought this makes it a NOT-link-only answer. – user637338 Nov 28 '13 at 18:20
  • I disagree on can.'s comment: "This counts as a workaround, but not as convenient" as this depends on the use case. I am using the corners rather seldom. If you are using it all the time and want to switch it of during games or multi screen work, can. is right. – user637338 Nov 28 '13 at 18:29

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .