← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #185628]: Combining "focus" and "type" commands

 

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

Description changed to:
I have a script that opens two command windows, starts a telnet session
in each, then sends a sequence of commands to them. There are many
occasions when the script sends a command to window cmd_A, then a
command to window cmd_B, then to window cmd_A, etc.

Currently, I use the following code:

self.cmd_a.focus()
type("first command" + Key.ENTER)

self.cmd_b.focus()
type("second command" + Key.ENTER)

self.cmd_a.focus()
type("third command" + Key.ENTER)

self.cmd_b.focus()
type("fourth command" + Key.ENTER)
...etc.

Is there a way to shorten this to a single command or stack the commands? Something like:
self.cmd_b.type("command" + Key.ENTER)

I haven't found anything in the documentation that makes me think there
is, but if there is it would make my coding a bit neater. If all else
fails, I can create a function that takes the window and text as
parameters, but since it will be used so often I was hoping for a more
efficient way.

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