I’ve updated my AppleScript so that pressing ⌥ D repeatedly will cycle through the options:
left » bottom » right » left, etc
tell application "System Events" to tell dock preferences
if screen edge is bottom then
set screen edge to right
else if screen edge is right then
set screen edge to left
else if screen edge is left then
set screen edge to bottom
end if
end tell