How to read screen resolution and give as output?

In the beginning of my process I would like to get the current screen resolution. How can this be done?

1 Like

Hi @Stefan1,

Try this
Dim screenWidth as Integer = Screen.PrimaryScreen.Bounds.Width Dim screenHeight as Integer = Screen.PrimaryScreen.Bounds.Height

Regards,
Arivu

2 Likes

Thanks, Arivu!

Do you know how I can do this in UiPath Studio?
I tried using the Assign activity by writing myVariable = Screen.PrimaryScreen.Bounds.Height.
But this did not work. it says ‘‘Screen is not declared’’.

1 Like

You need to import the System.Windows.Forms namespace
image

Or alternatively, you can just use the entire line like:
System.Windows.Forms.Screen.PrimaryScreen.Bounds.Width

Regards.

5 Likes

Hi @Stefan1,
Import System.windows.forms namespace in import tab

Regards,
Arivu

2 Likes

Thanks Clayton and Arivu! It works perfect.

Regards,
Stefan

1 Like