It is currently May 8th, 2024, 9:00 am

ColorSelector

Skins that control functions in Windows or Rainmeter
User avatar
Nookz
Posts: 55
Joined: November 3rd, 2023, 7:22 pm

Re: ColorSelector

Post by Nookz »

Yincognito wrote: December 13th, 2023, 11:21 am I believe you're both on the right track, nice to see some progress in that area. The thing is, the W and H of a monitor will stay the SAME when scaled AFAIK, so just iterating through all monitors and get the sum by addition isn't going to be enough, as you should probably add the monitor dimension divided by its own scaling to get the correct sum.
Actually. I think I might have found an easy solution that seems to return the true dimensions regardless of scaling:

Code: Select all

Add-Type -AssemblyName System.Windows.Forms; [System.Windows.Forms.SystemInformation]::VirtualScreen.Width
If someone else can test this and confirms that it works for them too, i'll implement something with it.

Code: Select all

[Rainmeter]
Update=-1

[Variables]
TrueWidth=0
TrueHeight=0

[TrueWidth]
Measure=Plugin
Plugin=RunCommand
Program=PowerShell.exe
Parameter=-Command "Add-Type -AssemblyName System.Windows.Forms; [System.Windows.Forms.SystemInformation]::VirtualScreen.Width"
OutputType=ANSI
DynamicVariables=1
FinishAction=[!SetVariable TrueWidth [TrueWidth]][!UpdateMeter Result][!ReDraw]

[TrueHeight]
Measure=Plugin
Plugin=RunCommand
Program=PowerShell.exe
Parameter=-Command "Add-Type -AssemblyName System.Windows.Forms; [System.Windows.Forms.SystemInformation]::VirtualScreen.Height"
OutputType=ANSI
DynamicVariables=1
FinishAction=[!SetVariable TrueHeight [TrueHeight]][!UpdateMeter Result][!ReDraw]

[Result]
Meter=String
Text="TrueWidth: #TrueWidth##CRLF#TrueHeight: #TrueHeight#"
Fontsize=20
leftMouseUpAction=[!CommandMeasure TrueWidth "Run"][!CommandMeasure TrueHeight "Run"]
FontColor=255,255,255
DynamicVariables=1
SolidColor=0,0,0
User avatar
Yincognito
Rainmeter Sage
Posts: 7207
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: ColorSelector

Post by Yincognito »

Nookz wrote: December 13th, 2023, 6:54 pm Actually. I think I might have found an easy solution that seems to return the true dimensions regardless of scaling:

Code: Select all

Add-Type -AssemblyName System.Windows.Forms; [System.Windows.Forms.SystemInformation]::VirtualScreen.Width
If someone else can test this and confirms that it works for them too, i'll implement something with it.
[...]
Well, for someone "extremely unfamiliar" with PowerShell, you surely got the vibe of it in no time... :thumbup:
The testing will be up to RicardoTM as he uses both scaling and a multi monitor system - hopefully the result will be positive. ;-)
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
RicardoTM
Posts: 272
Joined: December 28th, 2022, 9:30 pm
Location: México

Re: ColorSelector

Post by RicardoTM »

Nookz wrote: December 13th, 2023, 6:54 pm If someone else can test this and confirms that it works for them too, i'll implement something with it.

Code: Select all

[Rainmeter]
Update=-1

[Variables]
TrueWidth=0
TrueHeight=0

[TrueWidth]
Measure=Plugin
Plugin=RunCommand
Program=PowerShell.exe
Parameter=-Command "Add-Type -AssemblyName System.Windows.Forms; [System.Windows.Forms.SystemInformation]::VirtualScreen.Width"
OutputType=ANSI
DynamicVariables=1
FinishAction=[!SetVariable TrueWidth [TrueWidth]][!UpdateMeter Result][!ReDraw]

[TrueHeight]
Measure=Plugin
Plugin=RunCommand
Program=PowerShell.exe
Parameter=-Command "Add-Type -AssemblyName System.Windows.Forms; [System.Windows.Forms.SystemInformation]::VirtualScreen.Height"
OutputType=ANSI
DynamicVariables=1
FinishAction=[!SetVariable TrueHeight [TrueHeight]][!UpdateMeter Result][!ReDraw]

[Result]
Meter=String
Text="TrueWidth: #TrueWidth##CRLF#TrueHeight: #TrueHeight#"
Fontsize=20
leftMouseUpAction=[!CommandMeasure TrueWidth "Run"][!CommandMeasure TrueHeight "Run"]
FontColor=255,255,255
DynamicVariables=1
SolidColor=0,0,0
It gives me

TrueWidth:3840
TrueHeight:1080
User avatar
Nookz
Posts: 55
Joined: November 3rd, 2023, 7:22 pm

Re: ColorSelector

Post by Nookz »

RicardoTM wrote: December 13th, 2023, 9:19 pm It gives me
:???: weird I tested by scaling all my monitors and it still returned the right values regardless which and if they were scaled or not. I probably forgot to restart powershell inbetween the tests or something silly like that..
I guess here goes my easy solution :?

I'll look into what Yincognito was saying earlier about finding the scaling of each monitor and making some math instead
RicardoTM
Posts: 272
Joined: December 28th, 2022, 9:30 pm
Location: México

Re: ColorSelector

Post by RicardoTM »

Nookz wrote: December 13th, 2023, 10:00 pm :???: weird I tested by scaling all my monitors and it still returned the right values regardless which and if they were scaled or not. I probably forgot to restart powershell inbetween the tests or something silly like that..
I guess here goes my easy solution :?

I'll look into what Yincognito was saying earlier about finding the scaling of each monitor and making some math instead
When I have more time I'll do some more tests with it. Changing windows resolution and moving stuff on the Nvidia settings as well.

Edit.

Alright, testing:

Things to keep in mind during this test:
Native Screen Resolutions:

Screen 1: 2560 * 1080 (21:9 wide screen)
Screen 2: 3840 * 2160 (16:9 normal small (13") screen)

The correct width measure while zoomed to 300% should be 6400. (2560 + 3840)

Test:

Second Screen 100% (No scale) (3840 * 2160)
TrueWidth:6400
TrueHeight:2160
Skin works as expected.

Second Screen scaled up to 300% through windows config, but keeping 4K resolution. (3840 * 2160)
TrueWidth: 3840
TrueHeight:1080
Skin fails to recognize 1/3 of the screen, it should be width:6400 since resolution hasn't changed.

Second Screen 100%, but changed resolution through windows config to 1280 * 720 (300%)
TrueWidth: 3840
TrueHeight: 1080
Skin works as expected. Result is correct due to actual resolution changed to 1280.

Apparently there is no way to zoom in the screen on the Nvidia Settings without changing the screen resolution. So that's just a windows thing, that should be stored somewhere in the registry.
User avatar
Nookz
Posts: 55
Joined: November 3rd, 2023, 7:22 pm

Re: ColorSelector

Post by Nookz »

I don't know what might be causing it, but I just went and tripled checked, still using this same command, and making sure I reopen powershell everytime this time:

Code: Select all

Add-Type -AssemblyName System.Windows.Forms; [System.Windows.Forms.SystemInformation]::VirtualScreen.Width
And for me it is always outputting the good values no matter what scale or resolutions I choose.

either way.. I don't think I really I have an other choice but to find a different solution now. it's on my to do list ^^
User avatar
Yincognito
Rainmeter Sage
Posts: 7207
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: ColorSelector

Post by Yincognito »

RicardoTM wrote: December 13th, 2023, 10:17 pmSecond Screen scaled up to 300% through windows config, but keeping 4K resolution. (3840 * 2160)
TrueWidth: 3840
TrueHeight:1080
Skin fails to recognize 1/3 of the screen, it should be width:6400 since resolution hasn't changed.
While you're correct in terms of real resolution (which hasn't changed), this is actually correct in terms of scaling, since 2560 / 100 % + 3840 / 300% = 2560 / 1 + 3840 / 3 = 3840. So, it appears that Nooks' find does indeed account for scaling, presenting "what you see is what you get" i.e. the scaling equivalent in "pixels" (or "scaled pixels", if you like).

Just curious, doesn't #SCREENAREAWIDTH@1#+#SCREENAREAWIDTH@2# return what you're looking for? Assuming it yields the unscaled real resolutions of your monitors...
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth