Advertisement
Guest User

Untitled

a guest
Jun 17th, 2019
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.17 KB | None | 0 0
  1. touch togags; open togags
  2.  
  3. chmod u+x togags
  4.  
  5. $ togags
  6. Automatic Graphics Switching is: OFF
  7. $ togags
  8. Automatic Graphics Switching is: ON
  9. $
  10.  
  11. #!/usr/bin/osascript
  12.  
  13. if running of application "System Preferences" then
  14. try
  15. quit application "System Preferences"
  16. on error
  17. do shell script "killall 'System Preferences'"
  18. end try
  19. end if
  20.  
  21. repeat while running of application "System Preferences" is true
  22. delay 0.1
  23. end repeat
  24.  
  25. tell application "System Preferences"
  26. reveal pane id "com.apple.preference.energysaver"
  27. repeat until exists window "Energy Saver"
  28. delay 0.1
  29. end repeat
  30. end tell
  31.  
  32. tell application "System Events" to tell ¬
  33. group 1 of window "Energy Saver" of application process "System Preferences"
  34. repeat until exists checkbox "Automatic graphics switching"
  35. delay 0.1
  36. end repeat
  37. click checkbox "Automatic graphics switching"
  38. set cbAGS to (value of checkbox "Automatic graphics switching") as boolean
  39. end tell
  40.  
  41. quit application "System Preferences"
  42.  
  43. if cbAGS then
  44. return " Automatic Graphics Switching is: ON"
  45. else
  46. return " Automatic Graphics Switching is: OFF"
  47. end if
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement