[Class] Monitor (Brightness, Contrast, Gamma Ramp)

Post your working scripts, libraries and tools
AladinZ
Posts: 2
Joined: 30 Sep 2017, 13:20

Re: Class Monitor (Brightness, ColorTemperature)

30 Sep 2017, 13:38

Hello. I have recently acquired an HDMI to VGA adapter, and found that it breaks DDC/CI. I have been experimenting with Class monitor, and it does the job for me. However, I would really like to be able to Incrementally change brightness with only two keyboard shortcuts, where each shortcut iteration adds or subtracts predefined values from the RGB channels, i.e., CTRL + Up and CTRL + down. Could you please provide a substitute to the script below that does that ?

Code: Select all

down::Monitor.SetBrightness(128, 128, 128)    ; Red - Green - Blue
up::Monitor.SetBrightness(10,  10,  10)    ; Red - Green - Blue
Thank you for the Incredible script.
User avatar
jNizM
Posts: 2639
Joined: 30 Sep 2013, 01:33
GitHub: jNizM
Contact:

Re: Class Monitor (Brightness, ColorTemperature)

04 Oct 2017, 02:33

@AladinZ

An example:

Code: Select all

; GLOBAL SETTINGS ===============================================================================================================

#NoEnv
#SingleInstance Force
#Persistent

SetBatchLines -1

; SCRIPT ========================================================================================================================

; Win + Numpad Add (+)    ->  Set Brightness incremental by 1
#NumpadAdd::
    CLR := Monitor.GetBrightness()
    Monitor.SetBrightness(CLR.Red + 1, CLR.Green + 1, CLR.Blue + 1)
return


; Win + Numpad Sub (-)    ->  Set Brightness decremental by 1
#NumpadSub::
    CLR := Monitor.GetBrightness()
    Monitor.SetBrightness(CLR.Red - 1, CLR.Green - 1, CLR.Blue - 1)
return


; Win + Numpad Mult (*)   ->  Set Brightness to default (128)
#NumpadMult::
    Monitor.SetBrightness(128, 128, 128)
return


; Win + Numpad Div (/)    -> Get Brightness
#NumpadDiv::
    GetBrightness := Monitor.GetBrightness()
    MsgBox % "Red:`t" GetBrightness.Red "`nGreen:`t" GetBrightness.Green "`nBlue:`t" GetBrightness.Blue
return


; INCLUDES ======================================================================================================================

#Include Class_Monitor.ahk

; ===============================================================================================================================
To set own Hotkeys see here -> docs/Hotkeys.htm
[AHK] 1.1.32.00 x64 Unicode | [WIN] 10 Pro (Version 2004) x64 | [GitHub] Profile
Donations are appreciated if I could help you
AISblu
Posts: 6
Joined: 14 Dec 2017, 11:18

Re: Class Monitor (Brightness, ColorTemperature)

14 Dec 2017, 12:11

jNizM

Thank you sooo much !!! I've been using transparent window to dimm screen for years.)
Are'nt you interested in monitor brightness auto ajustment according to current day light at local town (date, latitude, longitude, sunrise & sundown time) ?
I've been trying to port this funcs from .js and .cpp but no success.
Here is sample: http://suncalc.net/
ivill
Posts: 112
Joined: 13 May 2016, 02:23

Re: Class Monitor (Brightness, ColorTemperature)

24 Dec 2018, 04:23

Hi, Since the latest Windows 10 preview build 18305.rs_prerelease.181213-2133 installed, the script no longer works, anyone else who have the same issue?
User avatar
hasantr
Posts: 501
Joined: 05 Apr 2016, 14:18
Location: İstanbul

Re: Class Monitor (Brightness, ColorTemperature)

16 Dec 2019, 15:08

jNizM wrote:
04 Oct 2017, 02:33
Hi this class is great. But it doesn't turn off as much light as I'd like . Minimum brightness is not enough. Do you have a suggestion?
I thank you.
gregster
Posts: 4651
Joined: 30 Sep 2013, 06:48

Re: Class Monitor (Brightness, ColorTemperature)

16 Dec 2019, 15:16

hasantr wrote:
16 Dec 2019, 15:08
Hi this class is great. But it doesn't turn off as much light as I'd like . Minimum brightness is not enough. Do you have a suggestion?
A black full-screen window perhaps ?
User avatar
hasantr
Posts: 501
Joined: 05 Apr 2016, 14:18
Location: İstanbul

Re: Class Monitor (Brightness, ColorTemperature)

16 Dec 2019, 17:22

gregster wrote:
16 Dec 2019, 15:16
hasantr wrote:
16 Dec 2019, 15:08
Hi this class is great. But it doesn't turn off as much light as I'd like . Minimum brightness is not enough. Do you have a suggestion?
A black full-screen window perhaps ?
Thanks. I blacked out the monitor settings.
User avatar
hasantr
Posts: 501
Joined: 05 Apr 2016, 14:18
Location: İstanbul

Re: Class Monitor (Brightness, ColorTemperature)

19 Jan 2020, 08:48

jNizM wrote:
26 May 2015, 06:02
Class Monitor
Set monitors brightness and color temperature


Source
Class_Monitor.ahk (GitHub)


Example
Image


References
* GetDeviceGammaRamp
* SetDeviceGammaRamp
* How to Convert Temperature (K) to RGB


Contributing
- thanks to AutoHotkey Community


Questions / Bugs / Issues
Please report any bugs or issues here. Same for any questions.


Copyright and License
The Unlicense
This class is great. I thank you. There is only one problem. When the low brightness is adjusted, the effect of the temperature decreases.
How can the temperature effect be maintained despite this low brightness.
User avatar
PipeDreams
Posts: 149
Joined: 19 Dec 2015, 00:20

Re: Class Monitor (Brightness, ColorTemperature)

06 Mar 2020, 02:33

ivill wrote:
24 Dec 2018, 04:23
Hi, Since the latest Windows 10 preview build 18305.rs_prerelease.181213-2133 installed, the script no longer works, anyone else who have the same issue?
OMFG YES!!! I have been putting off this update for ever, but I can no longer do that if I want other things to work on my PC. So, now I'm forced to choose between which products I want to work or not based on this stupid MicorSoft update....

I can't figure out if it is just a setting that got changed in the update or if AHK it self just needs to be updated to compensate for this MS update. I mean, I've made zero changes to this script, all I know is that it worked just fine before the update, and every time I uninstall the update it works again...

For now I have resorted to dimming a semi-transparent black borderless window over my screen... and I hate it, because it causes other issues with scripts that use pixel search/find. :headwall: :cry:

windows 10 version 1909... AutoHotkey_1.1.32.00... Anyone know what is going on here?
User avatar
hasantr
Posts: 501
Joined: 05 Apr 2016, 14:18
Location: İstanbul

Re: Class Monitor (Brightness, ColorTemperature)

08 Mar 2020, 17:59

PipeDreams wrote:
06 Mar 2020, 02:33
ivill wrote:
24 Dec 2018, 04:23
Hi, Since the latest Windows 10 preview build 18305.rs_prerelease.181213-2133 installed, the script no longer works, anyone else who have the same issue?
OMFG YES!!! I have been putting off this update for ever, but I can no longer do that if I want other things to work on my PC. So, now I'm forced to choose between which products I want to work or not based on this stupid MicorSoft update....

I can't figure out if it is just a setting that got changed in the update or if AHK it self just needs to be updated to compensate for this MS update. I mean, I've made zero changes to this script, all I know is that it worked just fine before the update, and every time I uninstall the update it works again...

For now I have resorted to dimming a semi-transparent black borderless window over my screen... and I hate it, because it causes other issues with scripts that use pixel search/find. :headwall: :cry:

windows 10 version 1909... AutoHotkey_1.1.32.00... Anyone know what is going on here?

I am in Windows 10 2004 insider structure. It continues to work for me.
User avatar
castorp
Posts: 3
Joined: 28 May 2020, 15:43

Re: Class Monitor (Brightness, ColorTemperature)

28 May 2020, 15:48

Such a pity that this script appears to be no longer working. A fantastic idea.
User avatar
hasantr
Posts: 501
Joined: 05 Apr 2016, 14:18
Location: İstanbul

Re: Class Monitor (Brightness, ColorTemperature)

28 May 2020, 15:57

castorp wrote:
28 May 2020, 15:48
Such a pity that this script appears to be no longer working. A fantastic idea.
It must be working. My work also uses this class and it works.

https://www.autohotkey.com/boards/viewtopic.php?f=6&t=70871
User avatar
castorp
Posts: 3
Joined: 28 May 2020, 15:43

Re: Class Monitor (Brightness, ColorTemperature)

28 May 2020, 16:46

Nope, your script also generates an error for me.
brighttemp.png
brighttemp.png (36.72 KiB) Viewed 2313 times
gregster
Posts: 4651
Joined: 30 Sep 2013, 06:48

Re: Class Monitor (Brightness, ColorTemperature)

28 May 2020, 16:51

castorp wrote:
28 May 2020, 16:46
Nope, your script also generates an error for me. brighttemp.png
Your error message shows HTML code, not AHK code.

So, I assume that you are doing something wrong downloading this class. Download the AHK code, not the HTML source of the github project page...
User avatar
castorp
Posts: 3
Joined: 28 May 2020, 15:43

Re: Class Monitor (Brightness, ColorTemperature)

28 May 2020, 16:58

Oops! Correct, just downloaded the whole folder and ran it -- works like a charm! Thank you gregster and hasantr!
User avatar
jNizM
Posts: 2639
Joined: 30 Sep 2013, 01:33
GitHub: jNizM
Contact:

Re: Class Monitor (Brightness, ColorTemperature)

26 Jun 2020, 06:23

Since GetDeviceGammaRamp and SetDeviceGammaRamp (limitations see msdn docu) are still not working for me since 1903 I'm working on the "Monitor Configuration API" from MSDN
You can use the monitor configuration functions to get information from a monitor and to change a monitor's settings. You can use these functions to :

- Change a monitor's geometry settings, such as the width and height of the display.
- Change image settings, such as brightness and contrast.
- Reset a monitor's settings to their factory defaults.
- Degauss the monitor.

Internally, the monitor configuration functions use the Display Data Channel Command Interface (DDC/CI) to send commands to the monitor.
First steps to the new class are done. Brightness, Contrast, Degauss and Resetting works so far. Changing "Color Temperature" and "RGB Settings" are not compatible with my monitor (can not test it), but will also be integrated.


Edit
Found a way to get GetDeviceGammaRamp and SetDeviceGammaRamp working again under Win 2004
[AHK] 1.1.32.00 x64 Unicode | [WIN] 10 Pro (Version 2004) x64 | [GitHub] Profile
Donations are appreciated if I could help you
Rafaews
Posts: 13
Joined: 16 Mar 2018, 21:19

Re: Class Monitor (Brightness, ColorTemperature)

05 Jul 2020, 17:11

jNizM wrote:
26 Jun 2020, 06:23
First steps to the new class are done. Brightness, Contrast, Degauss and Resetting works so far. Changing "Color Temperature" and "RGB Settings" are not compatible with my monitor (can not test it), but will also be integrated.

Edit
Found a way to get GetDeviceGammaRamp and SetDeviceGammaRamp working again under Win 2004
I hope I can replicate Windows 10's Night Mode with your new class. With your old one I'm not able to decrease the blue all the way down.

Good Luck!
User avatar
hasantr
Posts: 501
Joined: 05 Apr 2016, 14:18
Location: İstanbul

Re: Class Monitor (Brightness, ColorTemperature)

11 Jul 2020, 02:39

jNizM wrote:
26 Jun 2020, 06:23
Since GetDeviceGammaRamp and SetDeviceGammaRamp (limitations see msdn docu) are still not working for me since 1903 I'm working on the "Monitor Configuration API" from MSDN
You can use the monitor configuration functions to get information from a monitor and to change a monitor's settings. You can use these functions to :

- Change a monitor's geometry settings, such as the width and height of the display.
- Change image settings, such as brightness and contrast.
- Reset a monitor's settings to their factory defaults.
- Degauss the monitor.

Internally, the monitor configuration functions use the Display Data Channel Command Interface (DDC/CI) to send commands to the monitor.
First steps to the new class are done. Brightness, Contrast, Degauss and Resetting works so far. Changing "Color Temperature" and "RGB Settings" are not compatible with my monitor (can not test it), but will also be integrated.


Edit
Found a way to get GetDeviceGammaRamp and SetDeviceGammaRamp working again under Win 2004
Wonderful news. I'm looking forward to the new class.
User avatar
jNizM
Posts: 2639
Joined: 30 Sep 2013, 01:33
GitHub: jNizM
Contact:

Re: Class Monitor (Brightness, ColorTemperature)

14 Jul 2020, 07:11

First (new test) release
code -> https://www.autohotkey.com/boards/viewtopic.php?p=343504#p343504


Display variable can be \\.\DISPLAY1 (or higher) or just the number behind DISPLAY (1 or 2...)
e.g.
Get Brightness -> MsgBox % Monitor.GetBrightness(1).Current
Set Brightness -> Monitor.SetBrightness("\\.\DISPLAY1", 80)
Set GammaRamp -> Monitor.SetGammaRamp(2, 128, 128, 95)

Please test and report bugs.
[AHK] 1.1.32.00 x64 Unicode | [WIN] 10 Pro (Version 2004) x64 | [GitHub] Profile
Donations are appreciated if I could help you
User avatar
hasantr
Posts: 501
Joined: 05 Apr 2016, 14:18
Location: İstanbul

Re: Class Monitor (Brightness, ColorTemperature)

15 Jul 2020, 11:12

I have tested. It works fine on my 24 inch BENQ monitor. I wish there was a way to adjust the blue light filter in a coordinated way to brightness.

Return to “Scripts and Functions”

Who is online

Users browsing this forum: Bing [Bot], Delta Pythagorean, leosouza85 and 24 guests