Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Similar to what someoneHuman said above, I use two functions that convert tap coordinates based on the difference in the resolution of the device I originally wrote the script for and whatever device I am currently using.</p> <p>First I get the current devices x and y pixel width.</p> <pre><code>CurrentDeviceX = float(device.getProperty("display.width")) CurrentDeviceY = float(device.getProperty("display.height")) </code></pre> <p>Then I define a function for converting x and y coordinates. You can see that the functions below were written for a device that is 1280 x 800.</p> <pre><code>def transX(x): ''' (number) -&gt; intsvd TransX takes the x value supplied from the original device and converts it to match the resolution of whatever device is plugged in ''' OriginalWidth = 1280; #Get X dimensions of Current Device XScale = (CurrentDeviceX)/(OriginalWidth) x = XScale * x return int(x) def transY(y): ''' (number) -&gt; int TransY takes the y value supplied from the original device and converts it to match the resolution of whatever device is plugged in. ''' OriginalHeight = 800; #Get Y dimensions of Current Device YScale = (CurrentDeviceY)/(OriginalHeight) y = YScale * y return int(y) </code></pre> <p>Then I can use these functions when creating tap events in my scripts.</p> <p>example</p> <pre><code>device.touch(transX(737), transY(226), 'DOWN_AND_UP') </code></pre> <p>Please note that this approach is far from perfect, and it will only work if your app utilizes anchoring to adjust UI based on screen size. This is my quick and dirty approach to making scripts that work on multiple devices when UI IDs are unavailable.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload