In your example, variable = Region(100, 200, 300, 400) is scaled according to the scriptDimension.
If running the script on device with horizontal resolution 640, region variable will become upper left at (25, 50) with width 75 and height 100.
If running the script on device with horizontal resolution 1280, region variable will become upper left at (50, 100) with width 150 and height 200.
If running the script on device with horizontal resolution 2560, region variable will become upper left at (100, 200) with width 300 and height 400.
Note: It's nothing related with vertical resolution. Therefore, nothing related with aspect ratio. And compareDimension doesn't affect it.
For different aspect ratio, it's one method to use autoResize() and find the correct compareDimension.
ankulua.boards.net/thread/169/common-library-autoresizeautoResize may not work for some game on some aspect ratio. It's common for 4:3 aspect device running script developed under 16:9 or 16:10.
Then the only way is to write another script with new captured images under 4:3 devices.
Sometimes, it's easier to use different scripts for different aspect ratios than trying one script for all devices.
At least 4:3 could be considered independently.