Skip to content

Instantly share code, notes, and snippets.

@alexbabintsev
Forked from v1c77/route-screen.applescript
Created November 19, 2020 20:43
Show Gist options
  • Save alexbabintsev/5b64a183f2755a74ded091cea28cb132 to your computer and use it in GitHub Desktop.
Save alexbabintsev/5b64a183f2755a74ded091cea28cb132 to your computer and use it in GitHub Desktop.
rotate display using applescript, tested on Mac os High Sierra(10.13)
--
-- Created by: v1c77
-- Created on: 2018/7/21
--
-- Copyright © 2018 v1c77, All Rights Reserved
--
use AppleScript version "2.7" -- Yosemite (10.10) or later
use scripting additions
tell application "System Preferences"
quit
delay 0.5
launch
activate
set current pane to pane "com.apple.preference.displays"
--reveal pane id "com.apple.preference.displays"
end tell
tell application "System Events"
tell application process "System Preferences"
tell window "DELL U2415" -- change the window name for different display
delay 1
click radio button "Display" of tab group 1
set theGroup to tab group 1
tell pop up button "Rotation:" of theGroup
set theStat to value of it
click
tell menu 1
if theStat = "Standard" then
click menu item 4 -- 270 dig
else
click menu item 1 -- standard
end if
end tell
end tell
end tell
end tell
end tell
tell application "System Preferences"
quit
end tell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment