increase or decrease brightness

Suggestions, feature requests and bug reports.
Post Reply
User avatar
davidp
Posts: 131
Joined: Mar 7th, ’18, 08:32

Post by davidp » Feb 23rd, ’19, 16:18

change the default shortcut used for brightness because I'm using another app called flux and i can't use Ctrl + wheelup/down
Last edited by davidp on Feb 27th, ’19, 09:16, edited 1 time in total.
User avatar
Tom
Posts: 791
Joined: Nov 24th, ’15, 23:39

Post by Tom » Feb 25th, ’19, 08:57

You can change the the default shortcut anytime.
User avatar
davidp
Posts: 131
Joined: Mar 7th, ’18, 08:32

Post by davidp » Feb 25th, ’19, 15:37

How to increase/decrease brightness by 3 or 5% or any other value
User avatar
Tom
Posts: 791
Joined: Nov 24th, ’15, 23:39

Post by Tom » Feb 27th, ’19, 08:34

I think you can change V variable in the script to something else.
bitsper2nd
Posts: 7
Joined: Jan 2nd, ’22, 18:05

Post by bitsper2nd » Oct 21st, ’22, 20:58

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
	}
}
Post Reply