Python 3.7 - Reading text from Terminal window
nir.zairi at gmail.com
nir.zairi at gmail.com
Fri Jul 26 00:33:34 EDT 2019
Hi,
I want it to wait for a specific text on the terminal window that it opens (putty.exe), how can i do it?
from pywinauto.application import Application
from pynput.keyboard import Key, Controller
print('Configuring')
app = Application().start(cmd_line=u'"C:\\...putty.exe" ')
puttyconfigbox = app.PuTTYConfigBox
puttyconfigbox.wait('ready')
listbox = puttyconfigbox.ListBox
listbox.select(u'COM5')
button = puttyconfigbox[u'&Load']
button.click()
button2 = puttyconfigbox[u'&Open']
button2.click()
keyboard = Controller()
keyboard.press(Key.enter)
keyboard.type('password1')
keyboard.press(Key.enter)
keyboard.type('enable\nconf t\n')
More information about the Python-list
mailing list