How to read screen resolution and give as output?

studio

#1

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


#2

Hi @Stefan1,

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

Regards,
Arivu


#3

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’’.


#4

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

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

Regards,
Arivu


#6

Thanks Clayton and Arivu! It works perfect.

Regards,
Stefan