Rank: Administration
Groups: Translators, Members, Administrators Joined: 1/11/2018(UTC) Posts: 1,382 ![United States United States](/Content/images/flags/US.png) Location: Tampa, FL Thanks: 28 times Was thanked: 430 time(s) in 363 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 StrokesPlus.net itself. https://www.strokesplus.net/files/DXMonitorBrightness.zipDownload the file into your StrokesPlus.net\Plug-Ins folder and Reload S+.net 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. Code: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.DXMonitorBrightness.GetMonitorFromPoint(action.Start);
//Get the physical monitor handle(s) from the monitor
var aPhysicalMonitors = DXMonitorBrightness.DXMonitorBrightness.GetPhysicalMonitors(hMonitor)
//Attempt to access the DX monitor APIs
try {
var dCurrentBrightness = host.cast(doubleT,DXMonitorBrightness.DXMonitorBrightness.GetMonitorBrightnessA(aPhysicalMonitors[0]));
sp.MessageBox("dCurrentBrightness: " + dCurrentBrightness, "dCurrentBrightness");
if(!DXMonitorBrightness.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.
DXMonitorBrightness.DXMonitorBrightness.DestroyPhysicalMonitors(aPhysicalMonitors);
}
Edited by user Tuesday, February 15, 2022 6:31:46 PM(UTC)
| Reason: Not specified
|
|
|
|
Rank: Member
Groups: Approved
Joined: 6/11/2021(UTC) Posts: 24 ![Croatia Croatia](/Content/images/flags/HR.png) Thanks: 6 times
|
Hi, this is what I get when I try to use the example script: Code:
[ScriptEngine.Execute() - ScriptEngineException] TypeError: DXMonitorBrightness.GetMonitorFromPoint is not a function
at Script [162]:13:36 -> var hMonitor = DXMonitorBrightness.GetMonitorFromPoint(action.Start);
Is there an easy way to make it work again?
|
|
|
|
Rank: Administration
Groups: Translators, Members, Administrators Joined: 1/11/2018(UTC) Posts: 1,382 ![United States United States](/Content/images/flags/US.png) Location: Tampa, FL Thanks: 28 times Was thanked: 430 time(s) in 363 post(s)
|
Hmm, in one of the recent updates changing the class structure, I thought I had this handled - but I guess not.
I've updated the original post script, try it out.
|
|
|
|
Rank: Advanced Member
Groups: Translators, Approved Joined: 7/17/2021(UTC) Posts: 135
Thanks: 35 times Was thanked: 18 time(s) in 15 post(s)
|
I am getting the following error when trying to use the provided script, Code:Error:
Error: An error occurred while transmitting data to the device on the I2C bus
Which has the following discussion on stackoverflow: I2C error when using the Windows Monitor Configuration FunctionsSomething about laptop displays not supporting DDC/CI..
Is there any alternative to this? ThanksEdit: Found that the error is already mentioned on the forum and another plugin which works for me. Link to post: Adjust Screen BrightnessEdited by user Monday, May 16, 2022 6:35:46 PM(UTC)
| Reason: Not specified
|
|
|
|
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.
Important Information:
The StrokesPlus.net Forum uses cookies. By continuing to browse this site, you are agreeing to our use of cookies.
More Details
Close