cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • Learn how to build custom Python data connectors and further customize JMP’s Data Connector Framework with the Python Data Connector Demo, available now in the JMP Marketplace!
  • See how to create experiments to support product design and ID useful product features. Register for June 12 webinar, 2pm US Eastern Time.

Discussions

Solve problems, and share tips and tricks with other JMP users.
Choose Language Hide Translation Bar
aharro
Level II

Users Windows Screen Resolution/Scale

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.

1 ACCEPTED SOLUTION

Accepted Solutions
jthi
Super User

Re: Users Windows Screen Resolution/Scale

You can use Run Program() to run command line or powershell and most likely get the information that way.

-Jarmo

View solution in original post

3 REPLIES 3
jthi
Super User

Re: Users Windows Screen Resolution/Scale

You can use Run Program() to run command line or powershell and most likely get the information that way.

-Jarmo
aharro
Level II

Re: Users Windows Screen Resolution/Scale

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.
aharro
Level II

Re: Users Windows Screen Resolution/Scale

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" )
	)
);
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);
);

Recommended Articles