Jump to content

Windows Desktop Dimmer / Shade


Ascend4nt
 Share

Recommended Posts

So, I've adjusted the code again, this time it reads in the Base RGB components of the Ramp when the script starts, and therefore it can retain values between runs. I also added a little text label to indicate what the value is changed the 'exit + reset' menu option to reset the value it read on script entry, and changed the name on the 'Reset' button to a more appropriate 'Default'. I've also added error checking and fixed 2 small bugs with _SetDeviceGammaRamp.

Maybe there should be a 'Reset' button too, I dunno.. I didn't want to complicate things much.

Anyhoo, here's the new version:

(*edit: read-blue value on GetDeviceGammaRampBaseRGB was off)

#NoTrayIcon
#include <Constants.au3>
#include <GUIConstantsEx.au3>
#include <SliderConstants.au3>
#include <StaticConstants.au3>
#include <WinAPI.au3>
#include <WindowsConstants.au3>

Opt("TrayOnEventMode", 1)
Opt("TrayMenuMode", 1)
Opt("GUIOnEventMode", 1)

;~ $hGUI_Tray = GUICreate(" DGC", 64, 200, 1, 1, Default, BitOR($WS_EX_TOPMOST, $WS_EX_TOOLWINDOW))
$hGUI_Tray = GUICreate(" DGC", 64, 214, 1, 1, Default, BitOR($WS_EX_TOPMOST, $WS_EX_TOOLWINDOW))
GUISetOnEvent($GUI_EVENT_CLOSE, "_Tray_GUI_Hide")
$c_Button_Reset = GUICtrlCreateButton("Default", 5, 7, 54, 20)
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
GUICtrlSetOnEvent(-1, "_Gamma_Default")
$cGammaVal = GUICtrlCreateLabel("128", 20, 202, 22, 14, $SS_CENTER)
$c_Slider_Average = GUICtrlCreateSlider(12, 28, 44, 175, BitOR($TBS_BOTH, $TBS_AUTOTICKS, $TBS_VERT))
$h_Slider_Average = GUICtrlGetHandle($c_Slider_Average)
GUICtrlSetLimit(-1, 256, 0)

$aBaseRGB = _GetDeviceGammaRampBaseRGB()
;~ ConsoleWrite("Gamma Ramp BaseRGB = R:"&$aBaseRGB[0]&", G:"&$aBaseRGB[1]&", B:"&$aBaseRGB[2]&@CRLF)
GUICtrlSetData(-1, $aBaseRGB[0])    ; 128 is default base
GUICtrlSetData($cGammaVal, $aBaseRGB[0])

GUIRegisterMsg($WM_ACTIVATE, "WM_ACTIVATE")
GUIRegisterMsg($WM_VSCROLL, "WM_VSCROLL")

TraySetClick(8)
TrayCreateItem("Exit")
TrayItemSetOnEvent(-1, "_Exit")
TrayCreateItem("Exit + Reset Gamma")
TrayItemSetOnEvent(-1, "_ExitReset")
TraySetOnEvent($TRAY_EVENT_PRIMARYDOWN, "_Tray_GUI_Show")
TraySetState()
TraySetToolTip("DGC - Desktop Gamma Changer (left click to change / right click to exit)")

;~ DllCall("psapi.dll","bool","EmptyWorkingSet","handle",-1)

While 1
    Sleep(100)
WEnd

Func _Exit()
    Exit
EndFunc   ;==>_Exit

Func _ExitReset()
    _SetDeviceGammaRamp($aBaseRGB[0], $aBaseRGB[1], $aBaseRGB[2])
    Exit
EndFunc

Func _Tray_GUI_Show()
    Local $aMousePos = MouseGetPos()
    WinMove($hGUI_Tray, "", $aMousePos[0] - 70, $aMousePos[1] - 245)
    GUISetState(@SW_SHOW, $hGUI_Tray)
    ControlFocus($hGUI_Tray,"",$c_Slider_Average)
EndFunc   ;==>_Tray_GUI_Show

Func _Tray_GUI_Hide()
    GUISetState(@SW_HIDE, $hGUI_Tray)
EndFunc   ;==>_Tray_GUI_Hide

Func _Gamma_Default()
    _SetDeviceGammaRamp(128, 128, 128)
    GUICtrlSetData($c_Slider_Average, 128)
    GUICtrlSetData($cGammaVal, 128)
    ControlFocus($hGUI_Tray,"",$c_Slider_Average)
EndFunc   ;==>_Gamma_Reset

Func WM_VSCROLL($hWnd, $iMsg, $wParam, $lParam)
    If ($iMsg = $WM_VSCROLL And $lParam = $h_Slider_Average) Then
        Local $nScrollType, $iPos
        $nScrollType = BitAND($wParam, 0xFFFF)    ; LoWord
        ; SB_THUMBPOSITION = 4, SB_THUMBTRACK = 5 (note: only 16-bits (0-65535) worth of precision if use $wParam)
        If ($nScrollType = 4 Or $nScrollType = 5) Then
            $iPos = BitAND(BitShift($wParam, 16), 0xFFFF)    ; HiWord
;~             ConsoleWrite("SB_THUMBPOSITION or SB_THUMBTRACK msg, pos = "&$iPos&@CRLF)
        Else
            ; Usually mouse-up brings us here:
            $iPos = GUICtrlRead($c_Slider_Average)
;~             ConsoleWrite("GuiCtrlRead value:"&$iPos&@CRLF)
        EndIf
        _SetDeviceGammaRamp($iPos, $iPos, $iPos)
        GUICtrlSetData($cGammaVal, $iPos)
    EndIf
    Return $GUI_RUNDEFMSG
EndFunc

Func WM_ACTIVATE($hWnd, $Msg, $wParam, $lParam)
    Switch $hWnd
        Case $hGUI_Tray
            If Not $wParam Then ; Window de-activated
                _Tray_GUI_Hide()
            EndIf
    EndSwitch
    Return $GUI_RUNDEFMSG
EndFunc   ;==>WM_ACTIVATE

; -----------------------------------------------------------------------------------------------------
; Func _GetDeviceGammaRampBaseRGB()
;
; Function to get the 1st RGB values of the Gamma Ramp.  If no other processes have modified the ramp,
; these 3 should be equal, and the rest of the ramp hopefully corresponds to what _SetDeviceGammaRamp()
; sets the values to.
;
; Return: a 3-element array representing the base RGB values of the Gamma Ramp
; $aArray[0] = Red
; $aArray[0] = Red
; $aArray[0] = Red
;
; Author: Ascend4nt
; -----------------------------------------------------------------------------------------------------
Func _GetDeviceGammaRampBaseRGB()
    Local $n_ramp, $i, $hDC, $aRet, $iErr
    Local $aBaseRGB[3] = [128, 128, 128]
    $hDC = _WinAPI_GetDC(0)
    If ($hDC = 0) Then Return SetError(2,@error,$aBaseRGB)

    $n_ramp = DllStructCreate("short[" & (256 * 3) & "]")
    $aRet = DllCall("gdi32.dll", "bool", "GetDeviceGammaRamp", "handle", $hDC, "ptr", DllStructGetPtr($n_ramp))
    $iErr = @error
    _WinAPI_ReleaseDC(0, $hDC)
    If $iErr Or Not $aRet[0] Then Return SetError(2,$iErr,$aBaseRGB)

    $aBaseRGB[0] = DllStructGetData($n_ramp, 1, 1) - 128     ; Red
    $aBaseRGB[1] = DllStructGetData($n_ramp, 1, 1+256) - 128 ; Green
    $aBaseRGB[2] = DllStructGetData($n_ramp, 1, 1+512) - 128 ; Blue

    Return $aBaseRGB
EndFunc    ;==>_GetDeviceGammaRampBaseRGB

Func _SetDeviceGammaRamp($vRed = 128, $vGreen = 128, $vBlue = 128)
    Local $n_ramp, $rVar, $gVar, $bVar, $aRet, $i, $hDC, $iErr
    If $vRed < 0 Or $vRed > 386 Then
        SetError(1)
        Return -1 ;Invalid Red value
    EndIf
    If $vGreen < 0 Or $vGreen > 386 Then
        SetError(2)
        Return -1 ;Invalid Green value
    EndIf
    If $vBlue < 0 Or $vBlue > 386 Then
        SetError(3)
        Return -1 ;Invalid Blue value
    EndIf

    $n_ramp = DllStructCreate("short[" & (256 * 3) & "]")
    For $i = 1 To 256
        $rVar = $i * ($vRed + 128)
        If $rVar > 65535 Then $rVar = 65535
        $gVar = $i * ($vGreen + 128)
        If $gVar > 65535 Then $gVar = 65535
        $bVar = $i * ($vBlue + 128)
        If $bVar > 65535 Then $bVar = 65535
        DllStructSetData($n_ramp, 1, Int($rVar), $i) ;red
        DllStructSetData($n_ramp, 1, Int($gVar), $i + 256) ;green
        DllStructSetData($n_ramp, 1, Int($bVar), $i + 512) ;blue
    Next

    $hDC = _WinAPI_GetDC(0)
    If ($hDC = 0) Then Return SetError(-1,@error,-1)

    $aRet = DllCall("gdi32.dll", "bool", "SetDeviceGammaRamp", "handle", $hDC, "ptr", DllStructGetPtr($n_ramp))
    $iErr = @error
    _WinAPI_ReleaseDC(0, $hDC)

    If $iErr Or Not $aRet[0] Then Return SetError(-1,$iErr,-1)

    Return 0
EndFunc   ;==>_SetDeviceGammaRamp
Edited by Ascend4nt
Link to comment
Share on other sites

Link to comment
Share on other sites

Hrm, doesn't matter to me what icon you choose, although I would personally think a typical monitor 'brightness' icon would work (https://www.google.com/search?q=brightness+icon&tbm=isch)

Link to comment
Share on other sites

Okay, after using this for a few days, I've found that it definitely needed that 'reset' button and a few other adjustments. I also figured out that my fix for brightness wasn't completely kosher - I should have been adjusting the DLLStruct indexing instead of the loop condition (although the loop was still off by 1). So, I made some tweaks to those things,and found an article that covers exactly what we are doing here, and probably what everyone else was basing code on, @ Nirsoft (Changing the screen brightness programmingly - By using the Gamma Ramp API). So I used that to make the (maybe) final tweaks to the code, which is below.

Also, hey - there's some free brightness icons here: http://findicons.com/search/brightness..

Here's the current version (note the 'retained' gamma from any previous runs will be off since this uses the correct ramp method):

#NoTrayIcon
#include <Constants.au3>
#include <GUIConstantsEx.au3>
#include <SliderConstants.au3>
#include <StaticConstants.au3>
#include <WinAPI.au3>
#include <WindowsConstants.au3>

; See 'Changing the screen brightness programmingly - By using the Gamma Ramp API:'
; @ http://www.nirsoft.net/vc/change_screen_brightness.html

; Singleton code:
If WinExists("0bc53fe0-59c2-11e2-bcfd-0800200c9a66") Then Exit
AutoItWinSetTitle("0bc53fe0-59c2-11e2-bcfd-0800200c9a66")

Opt("TrayOnEventMode", 1)
Opt("TrayMenuMode", 1+2)
Opt("GUIOnEventMode", 1)

$hGUI_Tray = GUICreate(" DGC", 64, 234, 1, 1, Default, BitOR($WS_EX_TOPMOST, $WS_EX_TOOLWINDOW))
GUISetOnEvent($GUI_EVENT_CLOSE, "_Tray_GUI_Hide")
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
$c_Button_Reset = GUICtrlCreateButton("Reset", 5, 5, 54, 20)
GUICtrlSetOnEvent(-1, "_ResetGamma")
$c_Button_Default = GUICtrlCreateButton("Default", 5, 27, 54, 20)
GUICtrlSetOnEvent(-1, "_Gamma_Default")
$c_Slider_Average = GUICtrlCreateSlider(12, 48, 44, 175, BitOR($TBS_BOTH, $TBS_AUTOTICKS, $TBS_VERT))
$h_Slider_Average = GUICtrlGetHandle($c_Slider_Average)
GUICtrlSetLimit(-1, 255, 0)
$cGammaVal = GUICtrlCreateLabel("128", 20, 222, 22, 14, $SS_CENTER)

$aBaseRGB = _GetDeviceGammaRampBaseRGB()
;~ ConsoleWrite("Gamma Ramp BaseRGB = R:"&$aBaseRGB[0]&", G:"&$aBaseRGB[1]&", B:"&$aBaseRGB[2]&@CRLF)
GUICtrlSetData($c_Slider_Average, $aBaseRGB[0])    ; 128 is default base
GUICtrlSetData($cGammaVal, $aBaseRGB[0])

GUIRegisterMsg($WM_ACTIVATE, "WM_ACTIVATE")
GUIRegisterMsg($WM_VSCROLL, "WM_VSCROLL")

TraySetClick(8)
Local $i = TrayCreateItem("Show Brightness Control")
TrayCreateItem("")
TrayItemSetOnEvent($i, "_Tray_GUI_Show")
TrayCreateItem("Default Gamma")
TrayItemSetOnEvent(-1, "_Gamma_Default")
TrayCreateItem("Reset Gamma")
TrayItemSetOnEvent(-1, "_ResetGamma")
TrayCreateItem("")
TrayCreateItem("Exit")
TrayItemSetOnEvent(-1, "_Exit")
TrayCreateItem("Exit + Reset Gamma")
TrayItemSetOnEvent(-1, "_ExitReset")
TraySetOnEvent($TRAY_EVENT_PRIMARYDOWN, "_Tray_GUI_Show")
TraySetState()
TraySetToolTip("DGC - Desktop Gamma Changer (left click to change / right click to exit)")

DllCall("psapi.dll","bool","EmptyWorkingSet","handle",-1)

While 1
    Sleep(100)
WEnd

Func _Exit()
    Exit
EndFunc   ;==>_Exit

Func _ExitReset()
    _SetDeviceGammaRamp($aBaseRGB[0], $aBaseRGB[1], $aBaseRGB[2])
    Exit
EndFunc

Func _Tray_GUI_Show()
    Local $aMousePos = MouseGetPos()
    WinMove($hGUI_Tray, "", $aMousePos[0] - 80, $aMousePos[1] - 260)
    GUISetState(@SW_SHOW, $hGUI_Tray)
    ControlFocus($hGUI_Tray,"",$c_Slider_Average)
EndFunc   ;==>_Tray_GUI_Show

Func _Tray_GUI_Hide()
    GUISetState(@SW_HIDE, $hGUI_Tray)
EndFunc   ;==>_Tray_GUI_Hide


Func _ResetGamma()
    _SetDeviceGammaRamp($aBaseRGB[0], $aBaseRGB[1], $aBaseRGB[2])
    GUICtrlSetData($cGammaVal, $aBaseRGB[0])
    GUICtrlSetData($c_Slider_Average, $aBaseRGB[0])
    If BitAND(WinGetState($hGUI_Tray), 2) Then ControlFocus($hGUI_Tray,"",$c_Slider_Average)
EndFunc   ;==>_Gamma_Reset

Func _Gamma_Default()
    _SetDeviceGammaRamp(128, 128, 128)
    GUICtrlSetData($c_Slider_Average, 128)
    GUICtrlSetData($cGammaVal, 128)
    If BitAND(WinGetState($hGUI_Tray), 2) Then ControlFocus($hGUI_Tray,"",$c_Slider_Average)
EndFunc   ;==>_Gamma_Default

Func WM_VSCROLL($hWnd, $iMsg, $wParam, $lParam)
    If ($iMsg = $WM_VSCROLL And $lParam = $h_Slider_Average) Then
        Local $nScrollType, $iPos
        $nScrollType = BitAND($wParam, 0xFFFF)    ; LoWord
        ; SB_THUMBPOSITION = 4, SB_THUMBTRACK = 5 (note: only 16-bits (0-65535) worth of precision if use $wParam)
        If ($nScrollType = 4 Or $nScrollType = 5) Then
            $iPos = BitAND(BitShift($wParam, 16), 0xFFFF)    ; HiWord
;~             ConsoleWrite("SB_THUMBPOSITION or SB_THUMBTRACK msg, pos = "&$iPos&@CRLF)
        Else
            ; Usually mouse-up brings us here:
            $iPos = GUICtrlRead($c_Slider_Average)
;~             ConsoleWrite("GuiCtrlRead value:"&$iPos&@CRLF)
        EndIf
        _SetDeviceGammaRamp($iPos, $iPos, $iPos)
        GUICtrlSetData($cGammaVal, $iPos)
    EndIf
    Return $GUI_RUNDEFMSG
EndFunc

Func WM_ACTIVATE($hWnd, $Msg, $wParam, $lParam)
    Switch $hWnd
        Case $hGUI_Tray
            If Not $wParam Then ; Window de-activated
                _Tray_GUI_Hide()
            EndIf
    EndSwitch
    Return $GUI_RUNDEFMSG
EndFunc   ;==>WM_ACTIVATE

; -----------------------------------------------------------------------------------------------------
; Func _GetDeviceGammaRampBaseRGB()
;
; Function to get the 1st RGB values of the Gamma Ramp.  If no other processes have modified the ramp,
; these 3 should be equal, and the rest of the ramp hopefully corresponds to what _SetDeviceGammaRamp()
; sets the values to.
;
; Return: a 3-element array representing the base RGB values of the Gamma Ramp
; $aArray[0] = Red
; $aArray[1] = Green
; $aArray[2] = Blue
;
; Author: Ascend4nt
; -----------------------------------------------------------------------------------------------------
Func _GetDeviceGammaRampBaseRGB()
    Local $n_ramp, $i, $hDC, $aRet, $iErr
    Local $aBaseRGB[3] = [128, 128, 128]
    $hDC = _WinAPI_GetDC(0)
    If ($hDC = 0) Then Return SetError(2,@error,$aBaseRGB)

    $n_ramp = DllStructCreate("short[" & (256 * 3) & "]")
    $aRet = DllCall("gdi32.dll", "bool", "GetDeviceGammaRamp", "handle", $hDC, "ptr", DllStructGetPtr($n_ramp))
    $iErr = @error
    _WinAPI_ReleaseDC(0, $hDC)
    If $iErr Or Not $aRet[0] Then Return SetError(2,$iErr,$aBaseRGB)
    ; 1st element should be 0, so second element of each ramp should have the value we need for the base
    $aBaseRGB[0] = DllStructGetData($n_ramp, 1, 1+1) - 128     ; Red
    $aBaseRGB[1] = DllStructGetData($n_ramp, 1, 1+1+256) - 128 ; Green
    $aBaseRGB[2] = DllStructGetData($n_ramp, 1, 1+1+512) - 128 ; Blue

    If $aBaseRGB[0] > 255 Then $aBaseRGB[0] = 255
    If $aBaseRGB[1] > 255 Then $aBaseRGB[1] = 255
    If $aBaseRGB[2] > 255 Then $aBaseRGB[2] = 255

    Return $aBaseRGB
EndFunc    ;==>_GetDeviceGammaRampBaseRGB

; -----------------------------------------------------------------------------------------------------
; Func _SetDeviceGammaRamp($vRed = 128, $vGreen = 128, $vBlue = 128)
;
; Sets GammaRamps for Red, Green, and Blue.  If all 3 inputs are equal, the net effect
; is that the brightness is adjusted.
;
; $vRed = value from 0 - 255
; $vGreen = value from 0 - 255
; $vBlue = value from 0 - 255
;
; Original AutoIt version (before fixes) appears to be at:
; http://autoit.de./index.php?page=Thread&postID=156967
;
; -----------------------------------------------------------------------------------------------------
Func _SetDeviceGammaRamp($vRed = 128, $vGreen = 128, $vBlue = 128)
    Local $n_ramp, $rVar, $gVar, $bVar, $aRet, $i, $hDC, $iErr

    If ($vRed < 0 Or $vRed > 255) Or _
      ($vGreen < 0 Or $vGreen > 255) Or _
      ($vBlue < 0 Or $vBlue > 255) Then
        Return SetError(1,0,-1)    ; Invalid value for one of the colors
    EndIf

    $n_ramp = DllStructCreate("short[" & (256 * 3) & "]")

    For $i = 0 To 255
        $rVar = $i * ($vRed + 128)
        If $rVar > 65535 Then $rVar = 65535
        $gVar = $i * ($vGreen + 128)
        If $gVar > 65535 Then $gVar = 65535
        $bVar = $i * ($vBlue + 128)
        If $bVar > 65535 Then $bVar = 65535
        ; +1 to account for 1-based index in a 0-255 based loop
        DllStructSetData($n_ramp, 1, Int($rVar), $i+1) ;red
        DllStructSetData($n_ramp, 1, Int($gVar), $i+1 + 256) ;green
        DllStructSetData($n_ramp, 1, Int($bVar), $i+1 + 512) ;blue
    Next

    $hDC = _WinAPI_GetDC(0)
    If ($hDC = 0) Then Return SetError(-1,@error,-1)

    $aRet = DllCall("gdi32.dll", "bool", "SetDeviceGammaRamp", "handle", $hDC, "ptr", DllStructGetPtr($n_ramp))
    $iErr = @error
    _WinAPI_ReleaseDC(0, $hDC)

    If $iErr Or Not $aRet[0] Then Return SetError(-1,$iErr,-1)

    Return 0
EndFunc   ;==>_SetDeviceGammaRamp
Link to comment
Share on other sites

Well, a few more tweaks and that butterfly is now flying my man! haha.. check the first post for the 'final' versions of the Dimmer and other scripts we all helped create.

Thanks everyone who contributed :)

And as always, any suggestions, improvements, or novel new ideas, please post!

Link to comment
Share on other sites

  • 4 months later...

Minor updates to WindowsDimmer.au3:

Changelog:

2013-05-14

+ Added _GraphicsIsGammaRampSupported() function which checks if the graphics device supports Gamma Ramps (used by WindowsDimmer.au3).

+ Small speedup of DLLCalls

Note, running the script in x86 mode appears to be more conservative with memory, if you keep an eye on that sort of thing

Link to comment
Share on other sites

I tested the update and works as expected. Thanks.

UDF List:

 
_AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples...

Updated: 22/04/2018

Link to comment
Share on other sites

  • 5 years later...

great program, very useful, thanks for developing this!

i stumbled upon this in my search for a utility that changes the screen "temperature" - i.e. makes the monitor color a bit more red at night - similar to what f.lux does. f.lux works well but is annoyingly hard to configure, with lots of features i don't need. web resources claim that changing the temperature is done via gamma adjustment, which is what this dimmer is doing - except it keeps the RGP values identical, so the color remains in the gray scale. i tried to fiddle around with this line:

_SetDeviceGammaRamp($iPos, $iPos, $iPos)

(in the WM_VSCROLL function), changing combinations of values to $iPos/2 and other factors - but i can't get the colors quite as "reddish" as i want. my best attempt thus far is:

_SetDeviceGammaRamp($iPos/2, $iPos/3, $iPos/4)

and that produces an acceptable result only when i scroll all the way down.

am i in the right direction about this?

Edited by orbs

Signature - my forum contributions:

Spoiler

UDF:

LFN - support for long file names (over 260 characters)

InputImpose - impose valid characters in an input control

TimeConvert - convert UTC to/from local time and/or reformat the string representation

AMF - accept multiple files from Windows Explorer context menu

DateDuration -  literal description of the difference between given dates

Apps:

Touch - set the "modified" timestamp of a file to current time

Show For Files - tray menu to show/hide files extensions, hidden & system files, and selection checkboxes

SPDiff - Single-Pane Text Diff

 

Link to comment
Share on other sites

perhaps. since i'm allergic to Windows 10, i cannot test this. there are some alternatives for Windows 7 (i'm also investigating this), yet i believe it can be achieved with the tool presented in this topic, in pure AutoIt.

Signature - my forum contributions:

Spoiler

UDF:

LFN - support for long file names (over 260 characters)

InputImpose - impose valid characters in an input control

TimeConvert - convert UTC to/from local time and/or reformat the string representation

AMF - accept multiple files from Windows Explorer context menu

DateDuration -  literal description of the difference between given dates

Apps:

Touch - set the "modified" timestamp of a file to current time

Show For Files - tray menu to show/hide files extensions, hidden & system files, and selection checkboxes

SPDiff - Single-Pane Text Diff

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...