Advertisement
Guest User

Set to Windows Classic when on Battery Power

a guest
Nov 8th, 2011
703
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #SingleInstance Force
  2. #Persistent
  3. #NoEnv
  4. #NoTrayIcon
  5.  
  6. Loop
  7. {
  8.     If !GetPowerStatus()
  9.     {
  10.         Run "C:\Windows\Resources\Ease of Access Themes\classic.theme"
  11.         WinWait , Personalization
  12.         Sleep , 5000
  13.         WinClose , Personalization
  14.         Loop
  15.         {
  16.             If GetPowerStatus()
  17.             {
  18.                 Run "<Put the path of the theme you want to have when on AC power here>"
  19.                 WinWait , Personalization
  20.                 Sleep , 5000
  21.                 WinClose , Personalization
  22.                 Break
  23.             }
  24.         }
  25.     }
  26. }
  27. Return
  28.  
  29. GetPowerStatus()
  30. {
  31.     Global
  32.     VarSetCapacity(powerstatus, 12)
  33.     success := DllCall("kernel32.dll\GetSystemPowerStatus", uInt, &powerstatus)
  34.     ACLineStatus := GetInt(&powerstatus,0,1)
  35.     BatteryLifePercent := GetInt(&powerstatus,2,1)
  36.     Return ACLineStatus
  37. }
  38.  
  39. GetInt( p_address, p_offset, p_size )
  40. {
  41.     local value
  42.     loop, %p_size%
  43.         value += ( *( (p_address+p_offset) + (a_Index-1) ) << ( 8* ( a_Index-1 ) ) )
  44.     return, value
  45. }
  46.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement