← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #213012]: Using iterators with methods?

 

Question #213012 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/213012

Shawn Robertson posted a new comment:
thanks for the link! saved and reading however along with reading your
example, i'm still confused as to what you say at the end:


for x in range(1, 10):
    create_client(id)


here is my updated code and it doesn't seem to be working. it gives this error:

File "C:\Users\SROBER~1\AppData\Local\Temp\sikuli-tmp6867879333067216604.py", line 8, in create_client
 paste("Sikuli Test Client" + id)
TypeError: cannot concatenate 'str' and 'int' objects


i read the control flow doc and in the section for defining functions, from what i gather my code should be updated to look like this:

def create_client(id):
    type("n", KeyModifier.ALT)
    type("i")
    type("n", KeyModifier.CTRL)
    wait("IZI1IClassif.png")
    paste("Sikuli Test Client" + id)
    type(Key.TAB)
    type(Key.TAB)
    type(Key.TAB)
    type(Key.ENTER)
    paste("Sikuli Test Client Full Name")
    type(Key.TAB)
    paste("Address1")
    type(Key.TAB)
    paste("Address2")
    type(Key.TAB)
    paste("Address3")
    type(Key.TAB)
    paste("City")
    type(Key.TAB)
    paste("State")
    type(Key.TAB)
    paste("ZIP")
    type(Key.TAB)
    paste("Country")
    type(Key.TAB)
    type(Key.TAB)
    paste("555-555-5555")
    type(Key.TAB)
    type(Key.TAB)
    paste("555-555-5555")
    type(Key.TAB)
    type(Key.TAB)
    paste("555-555-5555")
    type(Key.TAB)
    type(Key.TAB)
    paste("555-555-5555")
    type(Key.TAB)
    type(Key.TAB)
    paste("example@xxxxxxxxxxx")
    type(Key.TAB)
    paste("example@xxxxxxxxxxx")
    type(Key.TAB)
    type(Key.TAB)
    type(Key.TAB)
    type(Key.TAB)
    type(Key.TAB)
    type("In reference to field")
    type("s", KeyModifier.CTRL)
    waitVanish(Pattern("1351792567535.png").similar(0.98))
    keyDown(Key.CTRL)
    type(Key.F4)
    keyUp(Key.CTRL)

for x in range(1, 3):      
    create_client(1)

-- 
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.