Python Forum

Full Version: [PyWinAuto] Please help me with Typekeys ()
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello everyone,
I have some code as below:
from pywinauto import application
from pywinauto import keyboard
app = application.Application()
app.connect(path= r"C:\Windows\system32\cmd.exe")
dlg = app.top_window_()
dlg.TypeKeys('cd /d C:\Program Files (x86)\',with_spaces = True)
keyboard.send_keys('{ENTER}')
dlg.TypeKeys('abc.exe')
keyboard.send_keys('{ENTER}')
Could you help me to show the (x86). Because it cannot show () so it notify error
Error:
The system cannot find the path specified.
Please help me!
Thanks all
backslash \ is a special character in strings use double backslash \\ to get a normal \
dlg.TypeKeys('cd /d C:\\Program Files (x86)\\',with_spaces = True)
(Apr-22-2019, 09:39 AM)Yoriz Wrote: [ -> ]backslash \ is a special character in strings use double backslash \\ to get a normal \
dlg.TypeKeys('cd /d C:\\Program Files (x86)\\',with_spaces = True)

Thank you very much :)