Combining "focus" and "type" commands
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_
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.
Question information
- Language:
- English Edit question
- Status:
- Solved
- For:
- SikuliX Edit question
- Assignee:
- No assignee Edit question
- Solved by:
- Mychal Miller
- Solved:
- Last query:
- Last reply: