Note that each Pattern object is a png of the different scalings ( 100%, 125%,
150% and 175% )
Don't take account of the indentations, I pasted it from my code.
type(Key.WIN)
wait(1)
paste('cmd.exe')
wait(1)
type(Key.ENTER)
wait(1)
paste('explorer ms-settings:display')
wait(0.5)
type(Key.ENTER)
wait(1.5)
#This part purpose is to recognize which scaling is set
if(exists(Pattern("1676468724224.png").similar(0.81))):
userResol= 100
type(Key.TAB)
type(Key.TAB)
type(Key.TAB)
type(Key.TAB)
wait(0.3)
type(Key.ENTER)
wait(0.3)
type(Key.DOWN)
wait(0.2)
type(Key.ENTER)
elif(exists(Pattern("1676468915634.png").similar(0.81))):
userResol= 125
elif(exists(Pattern("1676469068212.png").similar(0.81))):
userResol= 150
type(Key.TAB)
type(Key.TAB)
type(Key.TAB)
type(Key.TAB)
wait(0.3)
type(Key.ENTER)
wait(0.3)
type(Key.UP)
wait(0.2)
type(Key.ENTER)
elif(exists("1676470704370.png").similar(0.81)):
userResol= 175
type(Key.TAB)
type(Key.TAB)
type(Key.TAB)
type(Key.TAB)
wait(0.3)
type(Key.ENTER)
wait(0.3)
type(Key.UP)
type(Key.UP)
wait(0.2)
type(Key.ENTER)
#The else is used as a solution to get the elements inside the zone that is
detected (for 150% and 175%)
else:
click(Location(500,400))
Mouse.wheel(WHEEL_DOWN, 4)
And thanks for the workaround, I'll try that !
--
You received this bug notification because you are a member of Sikuli
Drivers, which is subscribed to SikuliX.
https://bugs.launchpad.net/bugs/2007980
Title:
Screen size wrong when changing monitor scaling programatically ---
workaround
Status in SikuliX:
In Progress
Bug description:
------------- workaround
after changing the monitor setup programmatically (e.g. scaling factor), you
have to use:
Screen.resetMonitors()
to let SikuliX reevaluate the monitor setup.
This works when running scripts from command line or in Java programs.
Be aware: The IDE GUI might look odd, because the changed monitor
parameters do not seem to be recognised yet everywhere (a bug ;-).
Either reset the monitors programatically to what they where at start
of the script or restart the IDE.
--------------------------------------------------
To avoid most of the resolution problems of Sikuli, I chnage within my script
the user windows desktop resolution (100% - 125% - 150% and 175%) and i put it
by default at 125%. The thing is that Sikuli is only looking in the old
resolution (for example, if i go from 150% to 125%, a large part of the bottom
and right side of the screen won't be detected, so if I need to find()
something here, it will never be able to). I don't know if it is fixable but i
might just post it here.
I am using version 2.0.5 under windows 10 64 bits.
Tried it on Java 8 and Java 17, both have the same problem.
If you want to reproduce the bug, just make a script which changes windows
resolution, then try to find something like the Wi-Fi logo on the bottom rigt
part of the screen. You can also open SikuliIDE while being at 150% or 175%,
then switch back to 125% and take a screenshot with the IDE tool made for it,
you will se the part of the screen that is ignored.
I know that relaunching SikuliIDE fixes it, but it is in the case that it is
needed to switch it inside the script, for portability between different
persons laptops.
To manage notifications about this bug go to:
https://bugs.launchpad.net/sikuli/+bug/2007980/+subscriptions
_______________________________________________
Mailing list: https://launchpad.net/~sikuli-driver
Post to : [email protected]
Unsubscribe : https://launchpad.net/~sikuli-driver
More help : https://help.launchpad.net/ListHelp