select

Asked by peter hasselby

I can not get the select() function to work.

I have tried following

login = ("outlook", "facebook", "workplace", "page3", "page4")
a = select("where do you like to log in?", options = login)

it show me this error message:

 [ sikulitemp-7621303983381196603 ] stopped with error in line 2
[error] TypeError ( popSelect(): 3rd arg can't be coerced to String )
[error] --- Traceback --- error source first
line: module ( function ) statement
432: Sikuli ( select ) return Sikulix.popSelect(msg, title, options, default)
2: main ( <module> ) selected = select("Please select an item from the list", options = items)
[error] --- Traceback --- end --------------

im using the 2.0.5

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
RaiMan (raimund-hocke) said :
#1

The select does not have positional parameters:

def select(msg="", title="Sikuli Selection", options=(), default=None)

so you have to write:

a = select(msg = "where do you like to log in?", options = login)

the title might also be a helpful parameter.

Revision history for this message
peter hasselby (smonxter) said :
#2

login = ("outlook", "facebook", "workplace", "page3", "page4")
def select(msg="", title="Sikuli Selection", options=(), default=None):
    a = select(msg = "where do you like to log in?", options = login)

tried the above.
did not come up with an error message. but did not do anything.

tried with:
login = ("outlook", "facebook", "workplace", "page3", "page4")
a = select(msg = "where do you like to log in?", options = login)

error:
[error] script [ sikulitemp-6386726409248896632 ] stopped with error in line 2
[error] TypeError ( popSelect(): 3rd arg can't be coerced to String )
[error] --- Traceback --- error source first
line: module ( function ) statement
432: Sikuli ( select ) return Sikulix.popSelect(msg, title, options, default)
2: main ( <module> ) a = select(msg = "where do you like to log in?", options = login)
[error] --- Traceback --- end --------------

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

Ok. Will check tomorrow. (Germany ;-)

Revision history for this message
RaiMan (raimund-hocke) said :
#4

Works on Win11 with 2.0.5 and Java 11 and 19

login = ("outlook", "facebook", "workplace", "page3", "page4")
a = select(msg = "where do you like to log in?", options = login)
print a

shows the select popup and prints the selected option or None if cancelled.

I am running the SikuliX IDE from the commandline using

"C:\Program Files\EclipseJDK\jdk19\bin\java" -jar <path-to-2.0.5.jar>

So something seems to be wrong wit your setup.

Revision history for this message
RaiMan (raimund-hocke) said :
#5

BTW:

login = ("outlook", "facebook", "workplace", "page3", "page4")
def select(msg="", title="Sikuli Selection", options=(), default=None):
    a = select(msg = "where do you like to log in?", options = login)

your def overwrites the SikuliX select function and simply does nothing but calling itself.

Can you help with this problem?

Provide an answer of your own, or ask peter hasselby for more information if necessary.

To post a message you must log in.