Hotkey to Change Laptop Brightness Topic is solved

Get help with using AutoHotkey and its commands and hotkeys
poetofpiano
Posts: 32
Joined: 25 Jan 2016, 14:26

Hotkey to Change Laptop Brightness

12 Aug 2017, 23:23

I have a Dell laptop and am trying to figure out how to set a hotkey in Autohotkey to control the screen brightness that is different from the default brightness hotkeys on my laptop, which don’t register in Autohotkey when I press them. I have researched this to death but cannot find a solution. The most promising post I found was at https://autohotkey.com/boards/viewtopic ... 1&p=126135 which uses the Windows native brightness function to adjust the screen brightness just like I want (I am not interested in using Autohotkey to create a GUI that dims the screen). But for some reason that script doesn’t work for me. I followed the instructions for that script at https://www.reddit.com/r/AutoHotkey/com ... ss_script/ and it just doesn’t work. The following is what the log reads when I try to execute the hotkey to change the brightness:

Code: [Select all] [Download] GeSHi © Codebox Plus

222: BS.SetBrightness(-10)  
034: if (increment == 0 && !jump)
040: if (!forceDifferentScheme ? DllCall(PowerGetActiveScheme, "Ptr", 0, "Ptr*", currSchemeGuid, "UInt") == 0 : DllCall("powrprof\PowerDuplicateScheme", "Ptr", 0, "Ptr", forceDifferentScheme, "Ptr*
077: }
222: Return (0.25)

Any help would be greatly appreciated!
qwerty12
Posts: 375
Joined: 04 Mar 2016, 04:33
GitHub: qwerty12

Re: Hotkey to Change Laptop Brightness  Topic is solved

13 Aug 2017, 05:33

poetofpiano wrote:But for some reason that script doesn’t work for me. I followed the instructions for that script at https://www.reddit.com/r/AutoHotkey/com ... ss_script/ and it just doesn’t work.


Replace the copied class with this one (or just save it as BrightnessSetter.ahk and do the usual library thing if you'd prefer):



The version you have is an old one, where it assumes powrprof.dll is always loaded (thanks to jeeswg, I found out it wasn't)...

EDIT: You're welcome, poetofpiano! Thanks for being the fourth person to use the script! :-)
Last edited by qwerty12 on 13 Aug 2017, 20:34, edited 1 time in total.
poetofpiano
Posts: 32
Joined: 25 Jan 2016, 14:26

Re: Hotkey to Change Laptop Brightness

13 Aug 2017, 13:37

Thank you both so much. qwerty12, your suggestion worked perfectly, thank you!

Return to “Ask For Help”

Who is online

Users browsing this forum: downstairs, Elgin, Trigg and 17 guests