← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #234579]: How to increment or combine Sikuli variables?

 

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

    Status: Open => Answered

RaiMan proposed the following answer:
so this would be more Python like and should do what you want:

# Define account and pass lists (arrays)
accts = ["Andrew", "Bill", "Chris", 
    ...<more here>..., 
    "Richard"]
passes = ["andyspass", "billyspass", "chrispass", 
    ...<more here>..., 
    "rickspass"]

#I put the workload in a function only to show the possibilities
def login(n):
    type(accts[n] + Key.TAB + passes[n]), click("Login.png") 
    wait(10)
    type(Key.TAB, KeyModifier.CTRL) 

for a in range (22):
    login(a)  

BTW, if you are interested how your solution would have done the job:
eval(type("account"+str(x) + Key.TAB + "pass"+str(x)))

or again more Python like:
eval(type("account%d"+ Key.TAB + "pass%d" % (x,x)))

... means, you have to build the statement to be executed as a string
and then use eval to execute it.

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