Skip to content

Instantly share code, notes, and snippets.

@iBug
Created January 30, 2023 16:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iBug/7f06ff243d4d1b5ea7f1abdd88923752 to your computer and use it in GitHub Desktop.
Save iBug/7f06ff243d4d1b5ea7f1abdd88923752 to your computer and use it in GitHub Desktop.
Simple GUI for ControlMyMonitor

A simple GUI for ControlMyMonitor.

Works by calling ControlMyMonitor.exe CLI, so you must download that software and put it in the same folder as the HTA file.

<!DOCTYPE html>
<html>
<head>
<title>ControlMyMonitor</title>
<meta http-equiv="X-UA-Compatible" content="IE=9">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.6.2/dist/css/bootstrap.min.css">
<hta:application id="ControlMyMonitor" maximizebutton="no" scroll="no" border="dialog" />
<script type="text/vbscript">
Dim Shell : Set Shell = CreateObject("WScript.Shell")
Function window_onload
Window.resizeTo 420, 180
Dim btnGroup, nB
Dim button, value
Set btnGroup = document.getElementById("btnBrightness")
For value = 0 To 25 Step 5
Set button = document.createElement("input")
button.setAttribute "type", "button"
button.setAttribute "class", "btn btn-primary"
button.id = value
button.value = value
Set button.onClick = GetRef("SetBrightness")
btnGroup.appendChild button
btnGroup.appendChild document.createTextNode(" ")
Next
Set btnGroup = document.getElementById("btnContrast")
For value = 50 To 70 Step 10
Set button = document.createElement("input")
button.setAttribute "type", "button"
button.setAttribute "class", "btn btn-secondary"
button.id = value
button.value = value
Set button.onClick = GetRef("SetContrast")
btnGroup.appendChild button
btnGroup.appendChild document.createTextNode(" ")
Next
End Function
Function SetBrightness
Shell.Run "ControlMyMonitor.exe /SetValueIfNeeded Primary 10 " & Me.Value, 0, False
End Function
Function SetContrast
Shell.Run "ControlMyMonitor.exe /SetValueIfNeeded Primary 12 " & Me.Value, 0, False
End Function
</script>
<style>
body {
font-family: "Amazon Ember",-apple-system,BlinkMacSystemFont,"Segoe UI","Roboto","Oxygen","Ubuntu","Cantarell","Fira Sans","Droid Sans","Helvetica Neue",sans-serif;
}
</style>
</head>
<body class="p-3 bg-light" style="background: transparent">
<div class="mb-3">
Brightness: <span id="btnBrightness"></span>
</div>
<div class="mb-0">
Contrast: <span id="btnContrast"></span>
</div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment