Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save keysie/9b28538d9b14d9787ac0495b141ca165 to your computer and use it in GitHub Desktop.
Save keysie/9b28538d9b14d9787ac0495b141ca165 to your computer and use it in GitHub Desktop.
dell display manager command line documentation
===============================================
Dell Display Manager
===============================================
Command language
-----------------------------------
A rich and flexible command language is supported via the
command-line, and command-line arguments can be combined.
Where appropriate, a specific display can be targeted by
prefacing the command with the display number, e.g.,
"2:AutoSetup"; if a display number is not specified the
command will be applied to the current selected display
or to all displays, as appropriate. Commands include:
SetActiveInput [DVI2/HDMI/DP2,etc] - switches active input
SetControl X Y - sets hex control X to hex value Y
IncControl X Y - increases the value of control X by Y
DecControl X Y - decreases the value of control X by Y
RestoreFactoryDefaults - restores factory defaults*
AutoSetup - executes an autosetup (analog only)*
RestoreLevelDefaults - restores level defaults*
RestoreColorDefaults - restores color defaults*
SetBrightnessLevel X - sets brightness to X% (0-100)*
SetContrastLevel X - sets contrast to X% (0-100)*
SetNamedPreset [Movie/CAL1,etc] - changes the Preset mode*
SetPowerMode [on/off] - sets the display power mode*
SetOptimalResolution - switches to optimal resolution
SaveProfile [Name] - save VCP(s) to named profile*
RestoreProfile [Name] - restore VCP(s) from named profile*
DeleteProfile [Name] - delete named profile
SetGridType [X] - changes Easy Arrange grid type to X
Rescan - rescans display hardware
Exit - terminates the program
Some of these commands require familiarity with the MCCS
standard. For example, the command to switch the OSD
language to Spanish would be "SetControl CC 0A"; to unlock
an OSD that has been inadvertently locked "SetControl CA 02".
Instructions can be combined on the command-line, and
assigned to standard Windows shortcuts with optional hotkeys.
For example:
"ddm.exe /RestoreLevelDefaults /2:SetContrastLevel 70"
would first restore level defaults on all monitors, and then
set the contrast level on monitor #2 to 70%.
NB: If not targeted to a specific monitor, commands listed
above that are tagged with an asterisk (*) apply to all
monitors to facilitate simple and uniform control over all
members of a multimonitor matrix. For instance, if executed
on a matrix of 16 identical monitors, the command-line:
"ddm.exe /SetNamedPreset Warm /SetBrightnessLevel 75"
would set all 16 monitors to Warm preset mode, with a
brightness level of 75%.
@keysie
Copy link
Author

keysie commented Jun 20, 2017

Simple batch script to schedule screen brightness adjustment
Call e.g. from Windows task scheduler on a 5min. basis after login

Credit for the "getTime" method: https://stackoverflow.com/a/21809886

@echo off
    setlocal enableextensions disabledelayedexpansion

    call :getTime now

    if "%now%" geq "07:00:00,00" (
	if "%now%" lss "08:00:00,00" ( 
	    set "brightness=35" 
	)
    )
    if "%now%" geq "08:00:00,00" (
	if "%now%" lss "09:00:00,00" ( 
	    set "brightness=40" 
	)
    )
    if "%now%" geq "09:00:00,00" (
	if "%now%" lss "10:00:00,00" ( 
	    set "brightness=45" 
	)
    )
    if "%now%" geq "10:00:00,00" (
	if "%now%" lss "18:00:00,00" ( 
	    set "brightness=50" 
	)
    )
    if "%now%" geq "18:00:00,00" (
	if "%now%" lss "19:00:00,00" ( 
	    set "brightness=45" 
	)
    )
    if "%now%" geq "19:00:00,00" (
	if "%now%" lss "20:00:00,00" ( 
	    set "brightness=40" 
	)
    )
    if "%now%" geq "20:00:00,00" (
	if "%now%" lss "21:00:00,00" ( 
	    set "brightness=30" 
	)
    )
    if "%now%" geq "21:00:00,00" (
	if "%now%" lss "22:00:00,00" ( 
	    set "brightness=20" 
	)
    )
    if "%now%" geq "22:00:00,00" (
	if "%now%" lss "23:00:00,00" ( 
	    set "brightness=10" 
	)
    )
    if "%now%" geq "23:00:00,00" (
	set "brightness=0" 
    )
    if "%now%" lss "07:00:00,00" ( 
	set "brightness=0" 
    )
    
    "C:\Program Files (x86)\Dell\Dell Display Manager\ddm.exe" /SetBrightnessLevel %brightness%
    
    endlocal
    exit /b


:: getTime
::    This routine returns the current (or passed as argument) time
::    in the form hh:mm:ss,cc in 24h format, with two digits in each
::    of the segments, 0 prefixed where needed.
:getTime returnVar [time]
    setlocal enableextensions disabledelayedexpansion

    :: Retrieve parameters if present. Else take current time
    if "%~2"=="" ( set "t=%time%" ) else ( set "t=%~2" )

    :: Test if time contains "correct" (usual) data. Else try something else
    echo(%t%|findstr /i /r /x /c:"[0-9:,.apm -]*" >nul || ( 
	set "t="
	for /f "tokens=2" %%a in ('2^>nul robocopy "|" . /njh') do (
	    if not defined t set "t=%%a,00"
	)
	rem If we do not have a valid time string, leave
	if not defined t exit /b
    )

    :: Check if 24h time adjust is needed
    if not "%t:pm=%"=="%t%" (set "p=12" ) else (set "p=0")

    :: Separate the elements of the time string
    for /f "tokens=1-5 delims=:.,-PpAaMm " %%a in ("%t%") do (
	set "h=%%a" & set "m=00%%b" & set "s=00%%c" & set "c=00%%d" 
    )

    :: Adjust the hour part of the time string
    set /a "h=100%h%+%p%"

    :: Clean up and return the new time string
    endlocal & if not "%~1"=="" set "%~1=%h:~-2%:%m:~-2%:%s:~-2%,%c:~-2%" & exit /b

@keysie
Copy link
Author

keysie commented Jun 20, 2017

call like this to prevent DOS box from opening

start "" /B "C:\Program Files (x86)\Dell\Dell Display Manager\brightness-scheduler.bat"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment