Documentation of "Use()" command

Asked by Nicolas LEGOUPIL

I hope it's not already answered/documented, but as you can imagine it's hard to find relevant results with "use" keyword in search.

There is no documentation about the "Use()" command which seems to be really useful, especially in multi-monitor environment ; the only article I found about it is this one :
https://answers.launchpad.net/sikuli/+question/708296

For example, I would like to know which is the current "default screen region" set in the running session (IDE or script) ; let's take this code and assume the command I'm looking for is "getCurrentDefaultScreen()":

getCurrentDefaultScreen() #should return 0 or 1, depending of the setup
use(Screen(2))
getCurrentDefaultScreen() #should return 2
use()
getCurrentDefaultScreen() #should return same as first line

Did I miss something?

Thanks in advance

Question information

Language:
English Edit question
Status:
Answered
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Launchpad Janitor (janitor) said :
#1

This question was expired because it remained in the 'Open' state without activity for the last 15 days.

Revision history for this message
Nicolas LEGOUPIL (nicobest01) said :
#2

Is there any answer here?

Revision history for this message
RaiMan (raimund-hocke) said (last edit ):
#3

Sorry for the delay.

No such feature, but this might help to make your own function:

showMonitors()
s0 = use()
print SCREEN.getID()
s1 = use(Screen(1))
print SCREEN.getID()

SCREEN always is the current default Screen object and getID() returns its current monitor ID.

Revision history for this message
sam carrans (samcaransa) said (last edit ):
#6

The "use()" command in SikuliX changes the active screen or region for your script. To get the current default screen, there isn't a direct built-in command like "getCurrentDefaultScreen()". You can use Screen.getBounds() or similar methods to detect the active screen.
https://njmcdirectt.us/

Can you help with this problem?

Provide an answer of your own, or ask Nicolas LEGOUPIL for more information if necessary.

To post a message you must log in.