getting screen resolution

tanutanu

Active member
Hi,

I would like to request to get screen width and hight as [screen_x] and [screen_y] variables.
These are very helpful for me to optimize each user interaction on multi devices when I write macros for everyone.
As you know, so many kind of device has different display resolution and some input actions are depend on the screen size. If all clickable button or text can access by their name, the requested feature would be useless. However, it sometimes happens to set a tap position as x,y coordinate because of unreadable name text.
Please consider to implement this feature. I guess it is not so hard because you had already put it on the dialog when setting a gesture x,y position.

Thanks:)
 

FrameXX

Active member
Hi. You can try using "shell script" action. Use command "wm size" and save output into variable. It should work without root. (I am rooted, but I choosed non-root and it worked.)

For example my exact output is: "Physical size: 1080x2280Override size: 787x1661"

I created a macro that will save your actual screen height and width into global integer variables.


Please tell me if it works for you.


But now you also need to do math which can be harder. If your screen width is 1000 and you click on 500 it means 50% of your screen. So if someone's width is 1200 it also needs to be 50% so 600. And how to get that 50%?

(500:1000)x100 = ((width you are clicking on) : (total screen width)) x (100) = 50%

x100 is essentialy not needed because that's just converting into %
You can say it's 0.5 of screen. It's also propably better.

Same thing you need to done with height.
 
Last edited:

tanutanu

Active member
Hi. You can try using "shell script" action. Use command "wm size" and save output into variable. It should work without root. (I am rooted, but i choosed non-root and it worked.)

For example my exact output is: "Physical size: 1080x2280Override size: 787x1661"

I created a macro that will save your screen height and width into global integer variables.


Please tell me if it works for you.

Thanks, Frame:)
I know that, but wm is not suppirted in all environment unfortunately. If it was installed, I don't need to request though.

Currently, I have two options to get them. One is getting from a web site which has spec sheet via http get, but not for all. The other is using tap action to get "home" x,y via touchtask plugin and calculate from it, but not for basic environment and impossible when a user has physical button or full screen gesture mode.
Calculating from density is not reliable when a user/manufacturer set different value.
 

tanutanu

Active member
Hi. You can try using "shell script" action. Use command "wm size" and save output into variable. It should work without root. (I am rooted, but I choosed non-root and it worked.)

For example my exact output is: "Physical size: 1080x2280Override size: 787x1661"

I created a macro that will save your actual screen height and width into global integer variables.


Please tell me if it works for you.


But now you also need to do math which can be harder. If your screen width is 1000 and you click on 500 it means 50% of your screen. So if someone's width is 1200 it also needs to be 50% so 600. And how to get that 50%?

(500:1000)x100 = ((width you are clicking on) : (total screen width)) x (100) = 50%

x100 is essentialy not needed because that's just converting into %
You can say it's 0.5 of screen. It's also propably better.

Same thing you need to done with height.
Frame,

Let me show my phone shell output when I have currently(non-rooted).
 

Attachments

  • Screenshot_2021-02-26-17-24-50-194_jackpal.androidterm_copy_1080x556.jpg
    Screenshot_2021-02-26-17-24-50-194_jackpal.androidterm_copy_1080x556.jpg
    137.2 KB · Views: 10

FrameXX

Active member
Frame,

Let me show my phone shell output when I have currently(non-rooted).
I thought that ADB commands should work on every android almost same. Weird.

You get same output with MacroDroid shell action?

Maybe there are other non-root commands.
 
Last edited:

tanutanu

Active member
Frame,

ADB might work fine.
The output is same as non-rooted Android shell to check for basic environment.
 

tanutanu

Active member
At first, executed "wm size" and got an error.
"getprop" command is good option to get various system environment values.
 

FrameXX

Active member
At first, executed "wm size" and got an error.
"getprop" command is good option to get various system environment values.
I tryed getprop but couldn't find resolution inside. I searched for my actual and physical resolution, but couldn't find anything.
 

tanutanu

Active member
I tryed getprop but couldn't find resolution inside. I searched for my actual and physical resolution, but couldn't find anything.
Yes, it doesn't provide any useful info about resolution. That's why I desire it as MD variable;)
On the other hand, you can get so many runtime information even though non-rooted:)
 

tanutanu

Active member
Hi,

I would like to request to get screen width and hight as [screen_x] and [screen_y] variables.
These are very helpful for me to optimize each user interaction on multi devices when I write macros for everyone.
As you know, so many kind of device has different display resolution and some input actions are depend on the screen size. If all clickable button or text can access by their name, the requested feature would be useless. However, it sometimes happens to set a tap position as x,y coordinate because of unreadable name text.
Please consider to implement this feature. I guess it is not so hard because you had already put it on the dialog when setting a gesture x,y position.

Thanks:)
@MacroDroidDev,

I wound like to request it again. I'm still need the simple feature, just getting coordinates values as the magic text. I have to use UI interaction action on multi devices which have various screen resolutions. It's really helpful when I use coordinates instead of string. String is sometimes bad for me because I have to consider the target devices' language settings in most cases. Strings depend on language but coordinates don't.

Cheers,
 

Attachments

  • IMG_20211014_100502.jpg
    IMG_20211014_100502.jpg
    93.3 KB · Views: 3
  • IMG_20211014_101016.jpg
    IMG_20211014_101016.jpg
    320.1 KB · Views: 3
Top