Guest User

AHK Script Screen Glitch Bug Main Code

a guest
May 11th, 2022
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.45 KB | None | 0 0
  1. #NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
  2. ; #Warn  ; Enable warnings to assist with detecting common errors.
  3. SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
  4. SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.
  5.  
  6. while (true) {
  7.   ; this gets the power state i think
  8.   VarSetCapacity(powerstatus, 1+1+1+1+4+4)
  9.   success := DllCall("kernel32.dll\GetSystemPowerStatus", "uint", &powerstatus)
  10.  
  11.   acLineStatus:=ReadInteger(&powerstatus,0,1,false)
  12.  
  13.   ReadInteger( p_address, p_offset, p_size, p_hex=true )
  14.   {
  15.     value = 0
  16.     old_FormatInteger := a_FormatInteger
  17.     if ( p_hex )
  18.       SetFormat, integer, hex
  19.     else
  20.       SetFormat, integer, dec
  21.     loop, %p_size%
  22.       value := value+( *( ( p_address+p_offset )+( a_Index-1 ) ) << ( 8* ( a_Index-1 ) ) )
  23.     SetFormat, integer, %old_FormatInteger%
  24.   return, value
  25.   }
  26.  
  27.  
  28.   ; if ac is not connected
  29.   if (acLineStatus == 0) {
  30.     ChangeResolution(32,1920,1080,60)
  31.   }
  32.  
  33.   ; if ac is connected
  34.   if (acLineStatus = 1) {
  35.     ChangeResolution(32,1920,1080,144)
  36.   }
  37.   ChangeResolution( cD, sW, sH, rR ) {
  38.   VarSetCapacity(dM,156,0), NumPut(156,2,&dM,36)
  39.   DllCall( "EnumDisplaySettingsA", UInt,0, UInt,-1, UInt,&dM ),
  40.   NumPut(0x5c0000,dM,40)
  41.   NumPut(cD,dM,104), NumPut(sW,dM,108), NumPut(sH,dM,112), NumPut(rR,dM,120)
  42.   Return DllCall( "ChangeDisplaySettingsA", UInt,&dM, UInt,0 )
  43.   }
  44. }
  45.  
Advertisement
Add Comment
Please, Sign In to add comment