← Back to team overview

sikuli-driver team mailing list archive

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

 

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

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.



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