Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
- ; #Warn ; Enable warnings to assist with detecting common errors.
- SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
- SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
- while (true) {
- ; this gets the power state i think
- VarSetCapacity(powerstatus, 1+1+1+1+4+4)
- success := DllCall("kernel32.dll\GetSystemPowerStatus", "uint", &powerstatus)
- acLineStatus:=ReadInteger(&powerstatus,0,1,false)
- ReadInteger( p_address, p_offset, p_size, p_hex=true )
- {
- value = 0
- old_FormatInteger := a_FormatInteger
- if ( p_hex )
- SetFormat, integer, hex
- else
- SetFormat, integer, dec
- loop, %p_size%
- value := value+( *( ( p_address+p_offset )+( a_Index-1 ) ) << ( 8* ( a_Index-1 ) ) )
- SetFormat, integer, %old_FormatInteger%
- return, value
- }
- ; if ac is not connected
- if (acLineStatus == 0) {
- ChangeResolution(32,1920,1080,60)
- }
- ; if ac is connected
- if (acLineStatus = 1) {
- ChangeResolution(32,1920,1080,144)
- }
- ChangeResolution( cD, sW, sH, rR ) {
- VarSetCapacity(dM,156,0), NumPut(156,2,&dM,36)
- DllCall( "EnumDisplaySettingsA", UInt,0, UInt,-1, UInt,&dM ),
- NumPut(0x5c0000,dM,40)
- NumPut(cD,dM,104), NumPut(sW,dM,108), NumPut(sH,dM,112), NumPut(rR,dM,120)
- Return DllCall( "ChangeDisplaySettingsA", UInt,&dM, UInt,0 )
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment