BigD7966

Detect display

Jul 23rd, 2024
792
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
AppleScript 0.45 KB | Source Code | 0 0
  1. tell application "System Settings" to activate
  2.  
  3. delay 0.5
  4.  
  5. tell application "System Events"
  6.     tell process "System Settings"
  7.         click menu item "Displays" of menu "View" of menu bar 1
  8.         try --don't even consider not using a try block!
  9.             key down option
  10.             delay 1.0
  11.             click button "Detect Displays" of window 1
  12.             delay 0.2
  13.             key up option
  14.         on error --logging out is the only other way to clear these
  15.             key up option
  16.         end try
  17.     end tell
  18. end tell
Advertisement
Add Comment
Please, Sign In to add comment