AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Dim Display if Away

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
ladiko



Joined: 13 Jul 2006
Posts: 187
Location: Berlin

PostPosted: Tue Oct 24, 2006 3:24 pm    Post subject: Dim Display if Away Reply with quote

the first part of this script looks if the notebook power source changes and set an predefined lcd brightness by SetLCDLevel.

i wanna dim my lcdscreen if i am away for x seconds. the defined time is given as DimTime in seconds. the SetLCDLevel subroutine does what it has to do. LCDLevel is an int between 0 and 8 and tells the brightness. the hot corner is an 10x10pixel area where the cursor should be placed if the script dont have to dim - cause i read a text or watch a video.

if this now works i will also reactivate the display if the user is back.

i have read this thread http://www.autohotkey.com/forum/viewtopic.php?t=9825 and used some parts of it -->

Code:
; Save LCDLevel at Script Start for later Comparison
Gosub, GetAcLineStatus
prevAcLineStatus = %AcLineStatus%
SetTimer, PowerStatus, 1000
Return
; ##################### End of main program #####################

GetAcLineStatus:
   VarSetCapacity(powerStatus, 1+1+1+1+4+4)
   success := DllCall("GetSystemPowerStatus", "UInt", &powerStatus)
   If (ErrorLevel != 0 OR success = 0)
   {
      AcLineStatus = 255
      Return
   }
   AcLineStatus := GetInteger(powerStatus, 0, false, 1)
   
Return

PowerStatus:
   GoSub, GetAcLineStatus
   If (prevAcLineStatus <> AcLineStatus)
   {
      prevAcLineStatus = %AcLineStatus%
      If AcLineStatus = 0
         LCDLevel = %Change2BatDispLevel%
      Else If AcLineStatus = 1
         LCDLevel = %Change2AcDispLevel%
      If (LCDLevel <> "No Change")
         GoSub, SetLCDLevel
   }
   if (DimTime <> 0)
      GoSub, TimeIdleCheck
Return

TimeIdleCheck:
   ; Hot-corner to keep screen on. *Credit to evl.*
   Coordmode, Mouse, Screen
   MouseGetPos, xMouseOrig, yMouseOrig
   If ((xMouseOrig <= 10) and (yMouseOrig <= 10))
      Return
   IdleTime := 1000 * %DimTime%
   If A_TimeIdlePhysical >= %IdleTime%
   {
      LCDLevel = 0
      GoSub, SetLCDLevel
      MsgBox, %A_TimeIdlePhysical% %IdleTime% %DimTime%
   }
Return


the msgbox dont show %idletime% but i dont understand why.
Back to top
View user's profile Send private message
BoBo
Guest





PostPosted: Tue Oct 24, 2006 3:37 pm    Post subject: Reply with quote

Quote:
IdleTime := 1000 * %DimTime%

Code:
IdleTime := 1000 * DimTime
That?
Back to top
ladiko



Joined: 13 Jul 2006
Posts: 187
Location: Berlin

PostPosted: Tue Oct 24, 2006 4:18 pm    Post subject: Reply with quote

*bonk* Rolling Eyes

thx Smile
Back to top
View user's profile Send private message
jak



Joined: 28 Feb 2006
Posts: 116

PostPosted: Mon Aug 11, 2008 6:12 am    Post subject: Reply with quote

ladiko - i know this is from a while ago, but does your dimming program here work by adjusting the actual backlight on the screen? If so, can you post your script in its entirety? Thanks...
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group