AutoHotkey Community

It is currently May 27th, 2012, 11:55 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 8 posts ] 
Author Message
 Post subject: Brightness Monitor
PostPosted: October 7th, 2010, 10:38 am 
Offline

Joined: November 14th, 2007, 9:43 am
Posts: 3
Hello everyone,
sorry I do not speak English.
I'm looking for a script to increase or decrease the brightness of the monitor. Can you help?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 7th, 2010, 1:10 pm 
Offline

Joined: July 28th, 2010, 10:36 pm
Posts: 75
The first question I'd ask is, is this a laptop or desktop monitor, etc. Most laptop monitors have software/hotkeys for this, which would make things pretty direct/simplified for assigning a hotkey, etc. But if it was a desktop monitor, I'm sure it could be done via a few diff methods (have at least 2 ideas myself).

Cheers.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 7th, 2010, 1:13 pm 
brightness no for desktop monitor
the control is on the monitor itself
and most likely u will hear ppl say overlay a grey/black gui, which has nothing to do with brightness


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: October 7th, 2010, 1:18 pm 
Offline

Joined: July 28th, 2010, 10:36 pm
Posts: 75
Anonymous wrote:
brightness no for desktop monitor
the control is on the monitor itself
and most likely u will hear ppl say overlay a grey/black gui, which has nothing to do with brightness


That was my idea! :P
Prob most viable, though I personally have absolutely no clue how to achieve that lol.

Goodluck with it, I searched around and this seems to be going in the right direction.

http://www.autohotkey.com/forum/viewtop ... brightness


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 7th, 2010, 5:18 pm 
Offline
User avatar

Joined: September 5th, 2009, 2:06 pm
Posts: 1718
Location: Somewhere near you
Hello again Giuseppe.. I have a script from Skrommel's site, and it's called Dim Screen.ahk

Made by: Skrommel
8)
Code:
;DimScreen.ahk
; Dim the screen via the tray icon
;Skrommel @2007

#SingleInstance,Force
#NoEnv
SetWinDelay,0

applicationname=DimScreen

Gosub,INIREAD
Gosub,MENU
Gosub,GUI

LOOP:
WinGet,id,Id,A
WinSet,AlwaysOnTop,On,ahk_id %guiid%
WinWaitNotActive,ahk_id %id%
IfWinNotExist,ahk_id %guiid%
  Gosub,GUI
Goto,LOOP


CHANGE:
Menu,Tray,UnCheck,% "&" dimming*10 "%"
If A_ThisMenuItem<>
  dimming:=A_ThisMenuItemPos-3
Menu,Tray,Check,% "&" dimming*10 "%"
WinSet,Transparent,% dimming*255/10,ahk_id %guiid%
Return


DECREASE:
Menu,Tray,UnCheck,% "&" dimming*10 "%"
dimming-=1
If dimming<0
  dimming=0
Menu,Tray,Check,% "&" dimming*10 "%"
WinSet,Transparent,% dimming*255/10,ahk_id %guiid%
Return


GUI:
Gui,+ToolWindow -Disabled -SysMenu -Caption +E0x20 +AlwaysOnTop
Gui,Color,000000
Gui,Show,% "X0 Y0 W" . A_ScreenWidth "H" . A_ScreenHeight,%applicationname% Screen
Gui,+LastFound
WinGet,guiid,Id,A
Gosub,CHANGE
Return


MENU:
Menu,Tray,DeleteAll
Menu,Tray,NoStandard
Menu,Tray,Add,%applicationname%,ABOUT
Menu,Tray,Default,%applicationname%
Menu,Tray,Add,
Loop,10
  Menu,Tray,Add,% "&" A_Index*10-10 "%",CHANGE
Menu,Tray,Add,
Menu,Tray,Add,&Settings...,SETTINGS
Menu,Tray,Add,&About...,ABOUT
Menu,Tray,Add,&Exit,EXIT
Menu,Tray,Tip,%applicationname%
Return


INCREASE:
Menu,Tray,UnCheck,% "&" dimming*10 "%"
dimming+=1
If dimming>9
  dimming=9
Menu,Tray,Check,% "&" dimming*10 "%"
WinSet,Transparent,% dimming*255/10,ahk_id %guiid%
Return


SETTINGS:
Hotkey,%hotkey1%,Off
Hotkey,%hotkey2%,Off
Gui,2:Destroy
Gui,2:Add,GroupBox,xm y+20 w175,&Startup dimming (0-90 `%)
Gui,2:Add,Edit,xp+10 yp+20 w155 vvdimming,% dimming*10
Gui,2:Add,GroupBox,xm y+20 w175 h70,&Increase dimming hotkey
Gui,2:Add,Hotkey,xp+10 yp+20 w155 vvhotkey1,% hotkey1
Gui,2:Add,Text,,Current: %hotkey1%
Gui,2:Add,GroupBox,xm y+20 w175 h70,&Decrease dimming hotkey
Gui,2:Add,Hotkey,xp+10 yp+20 w155 vvhotkey2,% hotkey2
Gui,2:Add,Text,,Current: %hotkey2%
Gui,2:Add,Button,xm y+20 w75 Default gSETTINGSOK,&OK
Gui,2:Add,Button,x+5 yp w75 gSETTINGSCANCEL,&CANCEL
Gui,2:Show,,%applicationname% Settings
Return


SETTINGSOK:
Gui,2:Submit
vdimming:=Floor(vdimming/10)
If (vdimming>=0 And vdimming<=9)
{
  IniWrite,%vdimming%,%applicationname%.ini,Settings,dimming
}
If vhotkey1<>
{
  hotkey1:=vhotkey1
  IniWrite,%hotkey1%,%applicationname%.ini,Settings,hotkey1
}
If vhotkey2<>
{
  hotkey2:=vhotkey2
  IniWrite,%hotkey2%,%applicationname%.ini,Settings,hotkey2
}

SETTINGSCANCEL:
Gui,2:Destroy
Hotkey,%hotkey1%,INCREASE
Hotkey,%hotkey2%,DECREASE
Return


INIREAD:
IniRead,dimming,%applicationname%.ini,Settings,dimming
If dimming=Error
  dimming=5
IniRead,hotkey1,%applicationname%.ini,Settings,hotkey1
If hotkey1=Error
  hotkey1=^+
IniRead,hotkey2,%applicationname%.ini,Settings,hotkey2
If hotkey2=Error
  hotkey2=^-
Hotkey,%hotkey1%,INCREASE
Hotkey,%hotkey2%,DECREASE
Return


ABOUT:
Gui,2:Destroy
Gui,2:Margin,20,20
Gui,2:Add,Picture,xm Icon1,%applicationname%.exe
Gui,2:Font,Bold
Gui,2:Add,Text,x+10 yp+10,%applicationname% v1.1
Gui,2:Font
Gui,2:Add,Text,y+10,Dim the whole screen.
Gui,2:Add,Text,xp y+5,- Change the brightness by selecting a `% in the tray menu.
Gui,2:Add,Text,xp y+5,- Or use the hotkeys Ctrl++ and Ctrl+-.
Gui,2:Add,Text,xp y+5,- Change hotkeys using Settings in the tray menu.
Gui,2:Add,Text,xp y+5,- Doesn't work properly with video windows.

Gui,2:Add,Picture,xm y+20 Icon2,%applicationname%.exe
Gui,2:Font,Bold
Gui,2:Add,Text,x+10 yp+10,1 Hour Software by Skrommel
Gui,2:Font
Gui,2:Add,Text,y+10,For more tools, information and donations, please visit
Gui,2:Font,CBlue Underline
Gui,2:Add,Text,y+5 G1HOURSOFTWARE,www.1HourSoftware.com
Gui,2:Font

Gui,2:Add,Picture,xm y+20 Icon7,%applicationname%.exe
Gui,2:Font,Bold
Gui,2:Add,Text,x+10 yp+10,DonationCoder
Gui,2:Font
Gui,2:Add,Text,y+10,Please support the contributors at
Gui,2:Font,CBlue Underline
Gui,2:Add,Text,y+5 GDONATIONCODER,www.DonationCoder.com
Gui,2:Font

Gui,2:Add,Picture,xm y+20 Icon6,%applicationname%.exe
Gui,2:Font,Bold
Gui,2:Add,Text,x+10 yp+10,AutoHotkey
Gui,2:Font
Gui,2:Add,Text,y+10,This tool was made using the powerful
Gui,2:Font,CBlue Underline
Gui,2:Add,Text,y+5 GAUTOHOTKEY,www.AutoHotkey.com
Gui,2:Font

Gui,2:Show,,%applicationname% - About

hCurs:=DllCall("LoadCursor","UInt",NULL,"Int",32649,"UInt") ;IDC_HAND
OnMessage(0x200,"WM_MOUSEMOVE")
Return

1HOURSOFTWARE:
Run,http://www.1hoursoftware.com,,UseErrorLevel
Return

DONATIONCODER:
Run,http://www.donationcoder.com,,UseErrorLevel
Return

AUTOHOTKEY:
Run,http://www.autohotkey.com,,UseErrorLevel
Return

ABOUTOK:
Gui,2:Destroy
OnMessage(0x200,"")
DllCall("DestroyCursor","Uint",hCurs)
Return

WM_MOUSEMOVE(wParam,lParam)
{
  Global hCurs
  MouseGetPos,,,,ctrl
  If ctrl in Static11,Static15,Static19
    DllCall("SetCursor","UInt",hCurs)
  Return
}


EXIT:
ExitApp

_________________
Image
The quick onyx goblin jumps over the lazy dwarf


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 15th, 2010, 7:10 pm 
Offline

Joined: June 14th, 2009, 7:48 pm
Posts: 331
[Solved] Brightness(Gamma) Control
May be it's what you're looking for :
F1:: ; reduce the brightness F1
F2:: ; Reset to 50%
F3:: ; increase the brightness F3
Code:
;#NoTrayIcon    don't display the script icon in the tray
#MaxHotkeysPerInterval 200
#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
#SingleInstance force
SetBatchLines -1
F2:: ; Set Brightness back to 50 % F2
br := 120 ; brightness, in the range of 0 - 255, where 128 is normal



F1:: ; reduce the brightness  F1
F3:: ; increase the brightness F3
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 = 300  ; 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.08 - 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) ;NULL for entire screen
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/2.5)
vbr := (br*100)//256 
if vol_Master = 128
{
  vol_Colour = Green
  vol_Text = Brightness %vbr%`%
}

if vol_Master > 128
{
  vol_Colour = Red   
  vol_Text = Brightness %vbr%`%
}
if vol_Master < 128
{
  vol_Colour = Blue

  vol_Text = Brightness %vbr%`%
}

; 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
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 27th, 2011, 11:10 pm 
Offline

Joined: January 13th, 2008, 6:00 pm
Posts: 115
I've been curious about this as well for quite a while. It appears that Windows Vista or at least Windows 7 supports this programmatically, but I don't know how to take advantage of ACPI_NOTIFY_INC_BRIGHTNESS_HOTKEY and ACPI_NOTIFY_DEC_BRIGHTNESS_HOTKEY in AHK.

Resources: http://msdn.microsoft.com/en-us/library/ff569755(VS.85).aspx
http://download.microsoft.com/download/ ... sCtrl.docx


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 10th, 2012, 10:47 pm 
I needed a "real brightness control" script for use on xp laptops/desktops (not some dimming gui or gamma change). If anyone is interested I can post it. The Brightness, controlled by only two hotkeys (F5 for + and F6 for - which you can change of course) , using powerstrip soft running in the background.


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

All times are UTC [ DST ]


Who is online

Users browsing this forum: Bing [Bot], BrandonHotkey and 18 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