AutoHotkey Community

It is currently May 26th, 2012, 11:21 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: November 16th, 2009, 11:06 pm 
I added a progress bar to change the brightness, but I have it slightly wrong shows progress, who can help

Code:
#NoTrayIcon    ; не отображать иконку скрипта в трее
#MaxHotkeysPerInterval 200
#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
#SingleInstance force
SetBatchLines -1

br := 128   ; brightness, in the range of 0 - 255, where 128 is normal

#F2::
#F1::
Brght_Step = 8

; -------------------
; START CONFIGURATION
; -------------------
; The percentage by which to raise or lower the volume each time
; How long to display the volume level bar graphs (in milliseconds)
vol_DisplayTime = 1500
; Transparency of window (0-255)
vol_TransValue = 200
; Bar's background colour
vol_CW = EEEEEE   
vol_Width = 200  ; width of bar
vol_Thick = 20   ; thickness of bar
; Bar's screen position
vol_PosX := A_ScreenWidth/2 - vol_Width/2
vol_PosY := A_ScreenHeight/1.8 - vol_Thick/2
; --------------------
; END OF CONFIGURATION
; --------------------
vol_BarOptionsMaster = 1:B1 ZH%vol_Thick% ZX8 ZY4 W%vol_Width% X%vol_PosX% Y%vol_PosY% CW%vol_CW%


br += (InStr(A_ThisHotkey, "F1") ? -Brght_Step : Brght_Step )
If ( br > 256 )
   br := 256
If ( br < 0)
   br := 0
VarSetCapacity(gr, 512*3)
Loop,   256
{
   If  (nValue:=(br+128)*(A_Index-1))>65535
        nValue:=65535
   NumPut(nValue, gr,      2*(A_Index-1), "Ushort")
   NumPut(nValue, gr,  512+2*(A_Index-1), "Ushort")
   NumPut(nValue, gr, 1024+2*(A_Index-1), "Ushort")
}
hDC := DllCall("GetDC", "Uint", 0)
DllCall("SetDeviceGammaRamp", "Uint", hDC, "Uint", &gr)
DllCall("ReleaseDC", "Uint", 0, "Uint", hDC)


vol_ShowBars:
; Get volumes in case the user or an external program changed them:
vol_Master := br
if vol_Master <> 128
{
  vol_Colour = Blue   
  vol_Text = Brightness
}
else
{
;  vol_Colour = Red
  vol_Text = Brightness (normal)

}


; To prevent the "flashing" effect, only create the bar window if it doesn't already exist:
IfWinNotExist, BrightnessOSDxyz
{
    Progress, %vol_BarOptionsMaster% CB%vol_Colour% CT%vol_Colour%, , %vol_Text%, BrightnessOSDxyz
    WinSet, Transparent, %vol_TransValue%, BrightnessOSDxyz
}


Progress, 1:%vol_Master% , , %vol_Text%
SetTimer, vol_BarOff, %vol_DisplayTime%
return


vol_BarOff:
SetTimer, vol_BarOff, off
Progress, 1:Off
return


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: November 16th, 2009, 11:51 pm 
Offline

Joined: April 8th, 2009, 7:49 pm
Posts: 6067
Location: San Diego, California
I tried your program and it brightens and dims the screen (actually both screens on my two-monitor setup) I kinda like it. :wink:

Can you be more specific on what it does or doesn't do that you want?


Report this post
Top
 Profile  
Reply with quote  
PostPosted: November 17th, 2009, 12:03 pm 
The script is not mine but from the branch
http://www.autohotkey.com/forum/topic32034.html
I just added another script on the progress bar, but I could not do it correctly and it does not appear correct, the end of progress should be a maximum brightness, but the middle is normal. Now the end of progress is normal and the end is not visible on the progress
It is not true displays itself progress, the script brightness working


Report this post
Top
  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: Bing [Bot], Cerberus, Google [Bot], Google Feedfetcher, Maestr0, rbrtryn, Tipsy3000, XstatyK and 68 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group