Guest User

Auto-change Alfred Theme on DarkMode

a guest
Nov 9th, 2014
250
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. set darktheme to "OS X Yosemite Dark Auto"
  2. set lighttheme to "OS X Yosemite Auto"
  3.  
  4. tell application "System Events"
  5.     set darkmode to (get dark mode of appearance preferences)
  6.    
  7.     if darkmode then
  8.         set themename to darktheme
  9.     else
  10.         set themename to lighttheme
  11.     end if
  12. end tell
  13.  
  14. tell application "Alfred Preferences" to activate
  15.  
  16. tell application "System Events" to tell process "Alfred Preferences"
  17.     tell window "Alfred Preferences"
  18.         tell toolbar 1
  19.             click button "Appearance"
  20.         end tell
  21.         tell tab group 1
  22.             click radio button "Theme"
  23.            
  24.             repeat with aRow in row of table 1 of scroll area 1
  25.                 if value of first static text of aRow is themename then select aRow
  26.             end repeat
  27.            
  28.         end tell
  29.        
  30.     end tell
  31. end tell
  32.  
  33. tell application "Alfred Preferences" to quit
RAW Paste Data