Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

Screen dimmer program.


  • Please log in to reply
6 replies to this topic
dangerdogL2121
  • Members
  • 636 posts
  • Last active: Nov 19 2015 03:39 AM
  • Joined: 22 Dec 2012

Here's a program I made that dims the screen. 

#SingleInstance,Ignore
runspeed=0
editspeed=0
Beg:
Hotkey,^Escape,end,Off
Gui, Add, Slider,x10 y70 w400 vrunspeed Range1-100 gchangespeed AltSubmit,%editspeed%
Gui, Add, Edit, x10 y110 w40 Number veditspeed geditchange,%editspeed%
Gui,add,text, x10 y10 +wrap,Select an amount of screen brightness.  Push ALT+z to turn off the dim and click or push CTRL+Escape while the screen is dimmed to exit the program.
Gui,add,button, x150 y100 gdim,Dim the screen.
Gui,Show,Center
return

Guiclose:
ExitApp

changespeed:
Gui, Submit, NoHide
GuiControl,, editspeed, %runspeed%
Return

editchange:
Gui,Submit, NoHide
GuiControl,, runspeed, %editspeed%
Return

dim:
if editspeed > 100
editspeed = 100
Gui,Destroy
Gui,color,000000
Gui, -Caption +AlwaysOnTop +E0x20 +owner
Gui,show, x0 y0 w%A_ScreenWidth% h%A_ScreenHeight%,Light Blocking GUI
WinSet, Transparent, %editspeed%, Light Blocking GUI
Hotkey,^Escape,end,On
return

!z::
Gui,Destroy
Gosub,beg
return

end:
Gui,Destroy
ExitApp
return





 

I added +owner in the options for the dimming gui.

Its short, but sweet.

Suggestions, comments?


There is a new AutoHotkey forum here.


HMSheets
  • Members
  • 1 posts
  • Last active: Sep 20 2015 11:10 PM
  • Joined: 06 Aug 2014

This is similar to another AHK script I found on an old forum from 2009. This one seems to be simpler though so I will probably switch to this one. Thanks!

 

Also if you happen to have multiple monitors and one is run off of a usb adapter and wont work with f.lux or a similar program, you can use this script along side f.lux and change the ordinates to work for the other monitor.

 

the line of code you would change is

Gui,show, x0 y0 w%A_ScreenWidth% h%A_ScreenHeight%,Light Blocking GUI

just change the y0 to to the width of the amount of pixels from y0.

 

If you don't know or don't remember how screen coordinates work you can refresh your memory here: http://www.flounder....coordinates.htm

 

Hope this helps anyone who has this problem or found it useful. It worked on the old script I mentioned with the a similar line of code so i don't see why it wouldn't work here and thanks again for the new script!



Xtra
  • Members
  • 954 posts
  • Last active: Jul 23 2016 09:04 PM
  • Joined: 29 Sep 2013
Gui,add,text, x10 y10 +wrap,Select an amount of screen brightness.  Push ALT+z to turn off the dim and click `n or push CTRL+Escape while the screen is dimmed to exit the program.

I added `n to this line.

 

When i started the script the gui was really wide.

I would change the edit box to text display and just use the slider only for adjusting the value.

 

I like,  its something i can use late night. :D



McSwingles
  • Members
  • 47 posts
  • Last active: Oct 20 2015 09:03 PM
  • Joined: 22 Jan 2014

I was just thinking, it would be awesome if you could do an auto adjust brightness which is determined by what time it is.

 

Day: *9am - 7pm = small increment increase per hour, after median has passed, would start getting lower. How long median is would be user defined and once in median, that setting would always be the same until it's time to come out of the median. Day and Night would also be user defined.

 

Night: *7:01pm - 8:59am = always lowest dim.

 

 

This is because if it is bright outside, you need the screen to be bright in order to see the screen. If it is dark, you don't need light because it is already dark and the lowest dim allows you to easily see.

 

The default auto dimmer lightens the screen when it's dark and darkens the screen when it's light outside. That makes no sense because you can't even see the screen if it is dim in the bright sun!

 

Another way the default auto dimmer does it, is based on how much of the screen is light or dark pixels. More light pixels than dark makes the screen brighter and more dark pixels than light make the screen darker. THAT STILL MAKES NO SENSE!!! Bright on brighter (when talking about pixels) fatigues the eyes and dark on darker (when talking about pixels) makes you can't see anything. What were they thinking?

 

And of course, the purpose for this is it being a power saving technique.



fox125cc
  • Members
  • 13 posts
  • Last active:
  • Joined: 21 Dec 2011

Nice little script. I use two monitors and your script is a nice way to dim them quickly. I like how you've only used a transparent window to create the illusion of dimming, so there are no settings being manipulated. Anyway, here's what I've done with it. 

#SingleInstance Force
#Persistent

RunSpeed=0
EditSpeed=0

Beg:
Gui, Show, x10 y70 w435 h100, Slider Gui
WinSet, Transparent, 210, Slider Gui
Gui, Color, Black
Gui, font, cAqua
Gui, +AlwaysOnTop -Border -Caption +Owner -Resize +ToolWindow +0x800000 
OnMessage( 0x200, "WM_MOUSEMOVE" )
Gui, Add, Slider, x10 y70 w420 AltSubmit Range1-200 -Theme ToolTipTop vRunSpeed gChangeSpeed ,%EditSpeed%
Gui, Add, Text, x20 y10, Hold (
Gui, Add, Text, x74 y10, ) for a second to toggle slider. Quickly double taping (
Gui, Add, Text, x350 y10, ) will end script.
Gui, Add, Text, x110 y25, The screen will dim after you've released Left Click.
Gui, Add, Text, x180 y50, Brightness Effect:
Gui, Add, Text, x414 y50, +
Gui, Add, Text, x22 y50, -
Gui, Add, Text, x400 y104, v2.1
Gui, Add, Edit, x-30 y110 w30 vEditSpeed gEditChange, %EditSpeed%
Gui, Show, Center
Gui, font, cYellow bold italic underline
Gui, Add, Text, x50 y10, Esc
Gui, Add, Text, x326 y10, Esc
Return

WM_MOUSEMOVE( Wparam, Lparam, MSG, HWND )
{If Wparam = 1 ;LButton
PostMessage, 0xA1, 2,,, A ;WM_NCLBUTTONDOWN
}
Return

ChangeSpeed:
Gui, Submit, NoHide
GuiControl,, EditSpeed, %Runspeed%
Return

EditChange:
Gui,Submit, NoHide
GuiControl,, Runspeed, %EditSpeed%
Return

Dim:
If EditSpeed > 200
EditSpeed = 200
Gui, Destroy
Gui, Color, 000000
Gui, -Caption +AlwaysOnTop +E0x20 +owner
Gui, Show, x0 y0 w3200 h1080, Light Blocking Gui
WinSet, Transparent, %EditSpeed%, Light Blocking Gui
Return

~$Esc::
KeyWait, Esc, T0.7
If (ErrorLevel)
{
RunSpeed=0
EditSpeed=0
Gui, Destroy
GoSub, Beg
}
Else 
{
If Esc_Presses > 0 
	{
	Esc_Presses += 1
	Return
	}
Esc_Presses = 1
SetTimer, ESC, 270
}
Return

ESC:
SetTimer, ESC, off
If Esc_Presses = 2 
{
Gui, Destroy
ExitApp
}
Esc_Presses = 0
Return

#IfWinActive Slider Gui
~Enter::
~LButton::
KeyWait, LButton
If EditSpeed < 2
{} ;DoNothing
Else
{
GoSub, Dim
}
Return


jNizM
  • Members
  • 928 posts
  • Last active: Jan 12 2018 09:23 AM
  • Joined: 01 Aug 2012
or take a look at this http://www.autohotke...htness-changer/
[AHK] 1.1.27.04 x64 Unicode | [WIN] 10 Pro (Version 1709)
My GitHub Profile | Donations are appreciated if I could help you

fox125cc
  • Members
  • 13 posts
  • Last active:
  • Joined: 21 Dec 2011

Good Stuff! Very useful!! Thx