Hello,
In regard to making scripts with jsl
Is there a way to get the user's screen resolution and scale(i.e., windows scale in system display settings)?
The problem is when some has their scale set to 150% vs 100%, the graphs and images will also change. Making it hard to read or they will completely miss a graph because they need to scroll to see it.
If I knew the answer to the first question, I'd be able to hard code the size of everything. I've tried using auto sizing features and they seem to be more of a pain than just setting the size manually.
You can use Run Program() to run command line or powershell and most likely get the information that way.
Thanks!
command = "Get-ItemProperty -path \!\\!"HKCU:\Control Panel\Desktop\PerMonitorSettings\*\!\\!" | fl DpiValue";
RP = Run Program(
Executable( "powershell.exe"),
Options( {"/c ", command} ),
ReadFunction( "text" )
);
show(RP);This returns DPI value which if display scaling is at 150% it will equal 0, at 175% it will be 1 and so on.
There's an easier way to resize all your graphs/windows/boxes, etc... dynamically per individual user that runs your scripts
1. Create a new window and maximize it
2. Grab the width of the window and it will return the pixels. (If the tangible width is 1920 and scaling is set to 150% then in theory, it should return 1280 pixels)
3. Have a function that sizes all of your boxes.. etc.. (I'd scale 2/3 if their width is < 1600)
4. Anytime you set the size of any graph/box/etc call set_width function
Hope this helps someone in the future
temp_window = New Window( "Width Check",
H List Box(
Text Box( "A" ),
sb1 = Spacer Box(),
Text Box( "B" ),
sb2 = Spacer Box( size( 20, 10 ), color( "red" ) ),
Text Box( "C" )
)
);<BR />
temp_window << Maximize Window( 1 );
USER_WIDTH = temp_window << Get Width();
temp_window << Close Window;
set_width = Function({w},
{},
new_w = w;
if(USER_WIDTH < 1600,
new_w = w * (2/3);
);
Return(new_w);
);