Welcome Guest! To enable all features please Login or Register.



Go to last post Go to first unread
#1 Posted : Tuesday, November 26, 2019 1:35:16 AM(UTC)

Rank: Administration


Groups: Translators, Members, Administrators
Joined: 1/11/2018(UTC)
Posts: 952
United States
Location: Tampa, FL

Thanks: 22 times
Was thanked: 274 time(s) in 239 post(s)
This plug-in adds the functionality of the original StrokesPlus' acGetMonitorBrightness and acSetMonitorBrightness functions. Note that this is dependent on DirectX and device compatibility, which is why it's not included in itself.

Download the file into your\Plug-Ins folder and Reload from the tray icon.

NOTE: Windows may mark the DLL as unsafe or blocked. Right click the DLL and select Properties, there will be an option to unblock it.

Here's an example script which first gets the brightness and shows it to you, then sets the brightness to 50% (0.5).
The brightness scale is 0.0 - 1.0 (it seems), where 1.0 is 100%, 0.5 is 50%, etc.

var doubleT = host.type('System.Double');
var dNewBrightness = host.cast(doubleT, 0.5);  //Set brightness to 50%, 1.0 would be 100%

//Get monitor from point
var hMonitor = DXMonitorBrightness.GetMonitorFromPoint(action.Start);

//Get the physical monitor handle(s) from the monitor
var aPhysicalMonitors = DXMonitorBrightness.GetPhysicalMonitors(hMonitor)

//Attempt to access the DX monitor APIs
try {
    var dCurrentBrightness = host.cast(doubleT,DXMonitorBrightness.GetMonitorBrightnessA(aPhysicalMonitors[0]));
    sp.MessageBox("dCurrentBrightness: " + dCurrentBrightness, "dCurrentBrightness");

    if(!DXMonitorBrightness.SetMonitorBrightnessA(aPhysicalMonitors[0], dNewBrightness)) {
        sp.MessageBox("Failed to update brightness", "DXMonitorBrightness");
} catch (err) {
    //An error was encountered either getting or setting the brightness 
    sp.MessageBox("Error:\n" + err, "Error");
} finally {
    // Close the monitor handles.
Users browsing this topic
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.