Hello dear community! I registered here because I had some real trouble with figuring out how to read the display brightness value and hope someone could help me, or at least give me a really good hint.What I have been trying to do is to use this script called BrightnessSetter (
https://autohotkey.com/boards/viewtopic ... 1&p=126135 and Github link:
https://gist.github.com/qwerty12/4b3f41 ... 5cc15c33c2) in order to simply get the brightness value. But I failed with that, and other alternatives, such as using the Powershell or using this (
https://autohotkey.com/boards/viewtopic.php?t=7854) are no alternative, because the first thing would demand higher user rights plus loading the Powershell just to get a simple value would drastically increase the loading time in my script. And the second link with that "Class Monitor" seems more about adjusting color values, and the lack of comments made it look highly confusing and it doesn't seem to read a brightness value anyway (sorry, just my opinion and that's how it looked like for me).
But back to the BrightnessSetter class. There is a part which does likely read the correct brightness value, but my previous attempts at somehow calling it failed:
Code: Select all
_GetCurrentBrightness(schemeGuid, AC, ByRef currBrightness)
{
static PowerReadACValueIndex := DllCall("GetProcAddress", "Ptr", BrightnessSetter.hPowrprofMod, "AStr", "PowerReadACValueIndex", "Ptr")
,PowerReadDCValueIndex := DllCall("GetProcAddress", "Ptr", BrightnessSetter.hPowrprofMod, "AStr", "PowerReadDCValueIndex", "Ptr")
return DllCall(AC ? PowerReadACValueIndex : PowerReadDCValueIndex, "Ptr", 0, "Ptr", schemeGuid, "Ptr", BrightnessSetter._GUID_VIDEO_SUBGROUP(), "Ptr", BrightnessSetter._GUID_DEVICE_POWER_POLICY_VIDEO_BRIGHTNESS(), "UInt*", currBrightness, "UInt") == 0
}
My question: How do I get the brightness value with that in a variable? My own script is basically a GUI with a few sliders, and one of them is for the brightness value. When the script starts, I need to figure out the current brightness value, or else it is ... well, just looking awkward. Setting brightness values isn't a problem, I made use of Nircmd in order to achieve that.
Previously I saw so many other useful posts here and hopefully this topic will be another good one for others who seek to do the same. Thanks in advance for your help!