jeremetron wrote:
ACTUALLY... I just put the brightness1.ahk, levels, and DisplayBrightnessDisplay files in my Startup folder but it causes the levels and current files to open whenever I restart Windows. Any idea on how to keep them from opening?
put the files somewhere else and place a shortcut to brightnes1.ahk in your startup folder.
Version 2
Whats new:
•greatly improved speed & stability (@jeremetron you will not have that error anymore). I wasn't closing my loops correctly and it was causing all sorts of problems. Still learning
•if you hold alt before pressing the hotkey, it will function as normal.
Code:
SetWorkingDir %A_ScriptDir%
FileInstall, DisplayBrightnessConsole.exe, DisplayBrightnessConsole.exe
FileInstall, nircmd.exe, nircmd.exe
#NoTrayIcon
#InstallKeybdHook
SetBatchLines, 10ms
SetTimer, LabelKill, 120000
IfNotExist, levels.txt
{
lvlcount = 0
RunWait %comspec% /c "(DisplayBrightnessConsole.exe -getlevels)>levels.txt",,Hide
}
loop, read, levels.txt
{
lvl%A_Index% := A_LoopReadLine
lvlcount += 1
}
maxlvl := lvl%lvlcount%
RunWait %comspec% /c DisplayBrightnessConsole>current.txt,,Hide
FileReadLine, currentlvl, current.txt, 1
#MaxThreadsBuffer On
*F5::
Critical
GetKeyState, state, Alt
if (state = "D")
{
SendInput, {F5}
Exit
}
if currentlvl = %lvl1%
{
Exit
}
loop , %lvlcount%
{
looplvl := lvl%A_Index%
if currentlvl = %looplvl%
{
newcount := A_Index-1
newlvl := lvl%newcount%
RunWait %comspec% /c DisplayBrightnessConsole %newlvl%,,Hide
break
}
}
RunWait %comspec% /c DisplayBrightnessConsole>current.txt,,Hide
FileReadLine, currentlvl, current.txt, 1
return
*F6::
Critical
GetKeyState, state, Alt
if (state = "D")
{
SendInput, {F6}
Exit
}
if currentlvl = %maxlvl%
{
Exit
}
loop , %lvlcount%
{
looplvl := lvl%A_Index%
if currentlvl = %looplvl%
{
newcount := A_Index+1
newlvl := lvl%newcount%
RunWait %comspec% /c DisplayBrightnessConsole %newlvl%,,Hide
break
}
}
RunWait %comspec% /c DisplayBrightnessConsole>current.txt,,Hide
FileReadLine, currentlvl, current.txt, 1
return
#MaxThreadsBuffer Off
*F7::
GetKeyState, state, Alt
if (state = "D")
{
SendInput, {F7}
Exit
}
Run %ComSpec% /c "nircmd.exe monitor off",,Hide
sleep 2000
Process, close, nircmd.exe
return
LabelKill:
RunWait %comspec% /c DisplayBrightnessConsole>current.txt,,Hide
FileReadLine, currentlvl, current.txt, 1
Process, close, nircmd.exe
return
you can grab the needed files from my earlier post or just run my precompiled version (brightness_v2.exe) and they will auto extract.
brightness_v2.exe
Enjoy!
-Aaron