← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #184364]: Run def from another def

 

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

RaiMan proposed the following answer:
What dinev wanted to say:
Defining / calling a function always should have / needs a pair of brackets, even if they are empty.
Mind the colon needed on the def line.
Rerun_app has to be first.

def Rerun_app():
          type(Key.ESC, KeyModifier.CTRL)
          wait(2)
          paste("C:\Windows\system32\cmd.exe\n")

def Run_app():
       switchapp("CMD")
       if not exist("CMD.png",5)
         run def Rerun_app()

your string with paste contains \'s, so you have to use raw string or
double the backslashes::

paste(r"C:\Windows\system32\cmd.exe" + "\n")

or

paste("C:\\Windows\\system32\\cmd.exe\n")

or even:

paste(r"C:\Windows\system32\cmd.exe"); type(Key.ENTER))

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