← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #193527]: passing runtime parameter to a variable used in sikuli

 

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

RaiMan proposed the following answer:
This is not available currently as a feature of input() (is on the
agenda though).

As a workaround, you can use the underlying Java classes directly.

A working example:

import javax.swing.JOptionPane as JOP
import javax.swing.JPasswordField as JPF

pwdF = JPF()
pwdValid = "123456"
isValid = False
trials = 3

while trials > 0:
    trials -= 1
    result = JOP.showConfirmDialog(None, pwdF,
        "Please enter Password ( 3 trials )",
        JOP.OK_CANCEL_OPTION)
    if result <> 0:
        break
    if pwdValid <> pwdF.getText():
        continue
    else:
        isValid = True
        break

if isValid:
    popup("Hello welcome")
else:
    popup("Sorry, go to hell!")

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