script to make a keyboard backlight timer

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
sulphuricsaliva
Posts: 48
Joined: 11 Sep 2018, 12:37

script to make a keyboard backlight timer

12 Oct 2018, 18:33

Hey guys, pretty sure this won't be possible but I have a wireless keyboard (anne pro 2) and use it exclusively with bluetooth and it does have the feature to auto turn the backlighting off after a minute to save battery but I think one minute is way too much time and I could extend the battery life by reducing that time out. I have the win key assigned to turn the backlight on and off and I end up doing it manually at night most of the time.

Is there any chance to create a script to turn off the backlighting by auto pressing the win key after a period of inactivity and turning it back on when I press any key?
Rohwedder
Posts: 7687
Joined: 04 Jun 2014, 08:33
Location: Germany

Re: script to make a keyboard backlight timer

13 Oct 2018, 01:49

Hallo,
try:

Code: Select all

#Persistent
#InstallKeybdHook
#InstallMouseHook
OffTime = 10000 ;10 Seconds
BackLightOn := True
SetTimer, BackLightToggle, 500
Return
BackLightToggle:
If (BackLightOn And A_TimeIdlePhysical > OffTime) 
Or (!BackLightOn And A_TimeIdlePhysical < OffTime)
{
	Send, {LWin} ;Toogle BackLight
	BackLightOn := !BackLightOn
}
Return
sulphuricsaliva
Posts: 48
Joined: 11 Sep 2018, 12:37

Re: script to make a keyboard backlight timer

13 Oct 2018, 04:39

IIt won't work because the winkey has been remaped by the keyboard's software. I tried scanning the key remaped with the backlight fucntion but it doesn't pick up anything :\
sulphuricsaliva
Posts: 48
Joined: 11 Sep 2018, 12:37

Re: script to make a keyboard backlight timer

13 Oct 2018, 04:49

I tried assigning the backlight toggle to a combination of keys fn1 + fn2 (SC04B and SC050) and tried modifying your script like this:

#Persistent
#InstallKeybdHook
#InstallMouseHook
OffTime = 10000 ;10 Seconds
BackLightOn := True
SetTimer, BackLightToggle, 500
Return
BackLightToggle:
If (BackLightOn And A_TimeIdlePhysical > OffTime)
Or (!BackLightOn And A_TimeIdlePhysical < OffTime)
{
Send, {SC04B}{SC050};Toogle BackLight
BackLightOn := !BackLightOn
}
Return

But still doesn't work.
Rohwedder
Posts: 7687
Joined: 04 Jun 2014, 08:33
Location: Germany

Re: script to make a keyboard backlight timer

13 Oct 2018, 06:51

Hallo,
first try to toogle BackLight with a simple Hotkey.
I don't think this is working:

Code: Select all

q::
Send, {SC04B}{SC050};Toogle BackLight
Return
But maybe this?:

Code: Select all

q::
Send, {SC04B Down}{SC050 Down}
Sleep, 100
Send, {SC04B Up}{SC050 Up}
Return
User avatar
Scr1pter
Posts: 1277
Joined: 06 Aug 2017, 08:21
Location: Germany

Re: script to make a keyboard backlight timer

13 Oct 2018, 16:22

Can you turn off the backlight by using the keyboard software?
Perhaps ControlClick or ControlSend might help.
(But only if you can turn it off using the software)

Regards
Please use [code][/code] when posting code!
Keyboard: Logitech G PRO - Mouse: Logitech G502 LS - OS: Windows 10 Pro 64 Bit - AHK version: 1.1.33.09
sulphuricsaliva
Posts: 48
Joined: 11 Sep 2018, 12:37

Re: script to make a keyboard backlight timer

14 Oct 2018, 05:37

I can only access the software using the keyboard via usb cable so...nop :\
User avatar
Scr1pter
Posts: 1277
Joined: 06 Aug 2017, 08:21
Location: Germany

Re: script to make a keyboard backlight timer

14 Oct 2018, 16:07

Could it be that some information is stored directly in the keyboard?
You connect the keyboard via USB, change some settings in the software and it gets stored in the keyboard's chip.

How is it if you use your keyboard on other devices?
E.g. Smart TV.

Regards
Please use [code][/code] when posting code!
Keyboard: Logitech G PRO - Mouse: Logitech G502 LS - OS: Windows 10 Pro 64 Bit - AHK version: 1.1.33.09
sulphuricsaliva
Posts: 48
Joined: 11 Sep 2018, 12:37

Re: script to make a keyboard backlight timer

14 Oct 2018, 16:59

Yes the information is stored directly in the keyboard. I never used it on anything other than the pc.
User avatar
Scr1pter
Posts: 1277
Joined: 06 Aug 2017, 08:21
Location: Germany

Re: script to make a keyboard backlight timer

14 Oct 2018, 19:10

But I don't unterstand why the software doesn't give you the option to change the limit.
I mean you can assign a key to turn off the light, yet you can't change the time limit.

Have you checked if there is a newer software version?

Looks like it is this keyboard:
https://flashquark.com/product/pre-orde ... -switches/
I took a quick look at its manual.
Couldn't find a timer setting.

Regards
Please use [code][/code] when posting code!
Keyboard: Logitech G PRO - Mouse: Logitech G502 LS - OS: Windows 10 Pro 64 Bit - AHK version: 1.1.33.09
sulphuricsaliva
Posts: 48
Joined: 11 Sep 2018, 12:37

Re: script to make a keyboard backlight timer

15 Oct 2018, 03:40

Yeah It's pretty much the only flaw in this keyboard so far, for me. There's no timer funcion, I've sent them an email with the suggestion but they'll probably just ignore it.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Beorn, cinematic6436, gongnl, nacken012, UncouthGoose and 128 guests