Ny way to change the mac dock’s position with a keyboard shortcut

applescriptautomatordockkeyboard

I don't think there are default shortcuts for that. But I assume you could make one using AppleScript or other automation programs.

I found this post from 2012 asking the same question. I tried making the script provided in the comments but couldn't make it work.

I'm not sure if it isn't working because Apple Scripts are different now, or because the script per se doesn't work or because there are steps I'm skipping.

When I try to save the script it says

“Expected “given”, “with”, “without”, other parameter name, etc. but found identifier.”

Any idea?

Best Answer

This AppleScript code works for me using the latest version of macOS Mojave.

tell application "System Events" to tell dock preferences
    if screen edge is bottom then
        set screen edge to left
    else if screen edge is left then
        set screen edge to bottom
    end if
end tell

In Automator, create a new Service or Quick Action and add a run AppleScript action to that workflow, adding the above AppleScript code. Then in System Preferences you can create a keyboard shortcut for that new service.