Similar to what someone said above, I use two functions that convert the coordinates of the transition based on the difference in resolution of the device that I originally wrote for the script for and any device that I currently use.
First, I get the current pixel widths x and y.
CurrentDeviceX = float(device.getProperty("display.width")) CurrentDeviceY = float(device.getProperty("display.height"))
Then I define a function to convert the x and y coordinates. You can see that the functions below were recorded for a 1280 x 800 device.
def transX(x): ''' (number) -> 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;
Then I can use these functions when creating click events in my scripts.
Example
device.touch(transX(737), transY(226), 'DOWN_AND_UP')
Please note that this approach is far from perfect, and it will only work if your application uses binding to customize the user interface based on screen size. This is my quick and dirty approach to creating scripts that run on multiple devices when UIs are not available.
source share