Hotkey to Change Laptop Brightness Topic is solved

Get help with using AutoHotkey and its commands and hotkeys
poetofpiano
Posts: 34
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: 421
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: 34
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!
User avatar
jamesbermudean
Posts: 2
Joined: 06 Oct 2017, 15:27

Re: Hotkey to Change Laptop Brightness

06 Oct 2017, 15:40

Hello, I am newbie here, but I have been using AutoHotkey since some years ago.
I was looking for a way to control my laptop's brightness, and your script seems to be the solution.
I am getting an error (Call to nonexistent function), and I have read that powrprof.dll is not loaded, but I don't know how to load it or fix it.
Any help would be much appreciated (I'm using Windows 10, x64, updated to last version).
Thank you so much :)

qwerty12 wrote:
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! :-)

Return to “Ask For Help”

Who is online

Users browsing this forum: Class1, KumaKun, Noesis, ronkwan, Yahoo [Bot] and 48 guests