Page 1 of 1

increase or decrease brightness

Posted: Feb 23rd, ’19, 16:18
by davidp
change the default shortcut used for brightness because I'm using another app called flux and i can't use Ctrl + wheelup/down

Re: change shortcut for brightness

Posted: Feb 25th, ’19, 08:57
by Tom
You can change the the default shortcut anytime.

Re: change shortcut for brightness

Posted: Feb 25th, ’19, 15:37
by davidp
How to increase/decrease brightness by 3 or 5% or any other value

Re: change shortcut for brightness

Posted: Feb 27th, ’19, 08:34
by Tom
I think you can change V variable in the script to something else.

Re: increase or decrease brightness

Posted: Oct 21st, ’22, 20:58
by bitsper2nd
Here is code gathered from other scripts. This should let you change the volume when the mouse pointer is on the taskbar and change the screen brightness when the pointer is on the right side of the screen.

Code: Select all

#NoEnv
#Persistent, On
#SingleInstance, Force
#WinActivateForce
#NoTrayIcon

; Change Volume with the mouse wheel on the taskbar
DetectHiddenWindows, On
SetTitleMatchMode, 2

MouseIsOver(WinTitle)
{
	MouseGetPos,,, Win
	return WinExist(WinTitle . " ahk_id " . Win)
}

#If MouseIsOver("ahk_class Shell_TrayWnd")
	WheelUp::Send, {Volume_Up}
	WheelDown::Send, {Volume_Down}
#If

; Change Brightness with the mouse wheel on the right edge of the screen
CoordMode Mouse, Screen

$WheelUp::
mouseGetPos,x
if (x >= A_ScreenWidth - 1)
  AdjustScreenBrightness(3) 
else
  Send {WheelUp}
Return

$WheelDown::
mouseGetPos,x
if (x >= A_ScreenWidth - 1)
  AdjustScreenBrightness(-3)
else
  Send {WheelDown}
Return

; Code for Adjusting Screen 
AdjustScreenBrightness(step) {
	static service := "winmgmts:{impersonationLevel=impersonate}!\\.\root\WMI"
	monitors := ComObjGet(service).ExecQuery("SELECT * FROM WmiMonitorBrightness WHERE Active=TRUE")
	monMethods := ComObjGet(service).ExecQuery("SELECT * FROM wmiMonitorBrightNessMethods WHERE Active=TRUE")
	for i in monitors {
		curr := i.CurrentBrightness
		break
	}
	toSet := curr + step
	if (toSet < 10)
		toSet := 10
	if (toSet > 100)
		toSet := 100
	for i in monMethods {
		i.WmiSetBrightness(1, toSet)
		break
	}
}