{"action":"created","issue":{"url":"https://api.github.com/repos/pywinauto/pywinauto/issues/556","repository_url":"https://api.github.com/repos/pywinauto/pywinauto","labels_url":"https://api.github.com/repos/pywinauto/pywinauto/issues/556/labels{/name}","comments_url":"https://api.github.com/repos/pywinauto/pywinauto/issues/556/comments","events_url":"https://api.github.com/repos/pywinauto/pywinauto/issues/556/events","html_url":"https://github.com/pywinauto/pywinauto/issues/556","id":356492968,"node_id":"MDU6SXNzdWUzNTY0OTI5Njg=","number":556,"title":"not able to click a button","user":{"login":"rajarameshmamidi","id":42936846,"node_id":"MDQ6VXNlcjQyOTM2ODQ2","avatar_url":"https://avatars3.githubusercontent.com/u/42936846?v=4","gravatar_id":"","url":"https://api.github.com/users/rajarameshmamidi","html_url":"https://github.com/rajarameshmamidi","followers_url":"https://api.github.com/users/rajarameshmamidi/followers","following_url":"https://api.github.com/users/rajarameshmamidi/following{/other_user}","gists_url":"https://api.github.com/users/rajarameshmamidi/gists{/gist_id}","starred_url":"https://api.github.com/users/rajarameshmamidi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rajarameshmamidi/subscriptions","organizations_url":"https://api.github.com/users/rajarameshmamidi/orgs","repos_url":"https://api.github.com/users/rajarameshmamidi/repos","events_url":"https://api.github.com/users/rajarameshmamidi/events{/privacy}","received_events_url":"https://api.github.com/users/rajarameshmamidi/received_events","type":"User","site_admin":false},"labels":[{"id":215838062,"node_id":"MDU6TGFiZWwyMTU4MzgwNjI=","url":"https://api.github.com/repos/pywinauto/pywinauto/labels/question","name":"question","color":"cc317c","default":true}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":35,"created_at":"2018-09-03T12:48:59Z","updated_at":"2018-10-17T21:05:55Z","closed_at":null,"author_association":"NONE","body":"Hi All,\r\n\r\nI am trying to automate windows based application which contains spaces in the application name.\r\nI am able to open app with the help of below code:\r\n```python\r\nfrom pywinauto.application import Application\r\napp=Application().start('c:\\\\program files\\\\ESPWorkstation.exe')\r\n```\r\n\r\nwe will receive a popup window (below) which allows us to proceed further\r\n![popup](https://user-images.githubusercontent.com/42936846/44987622-6f812780-afa5-11e8-8c4c-eab098d9f469.PNG)\r\n\r\nnow i need to click on load button to proceed further.\r\n\r\nCan some one help me on this issue?\r\n\r\nAlso, I need to navigate to a window which contains spaces after clicking load button to proceed with.\r\n\r\n\r\nThanks,\r\nrajarameshmamidi"},"comment":{"url":"https://api.github.com/repos/pywinauto/pywinauto/issues/comments/430789647","html_url":"https://github.com/pywinauto/pywinauto/issues/556#issuecomment-430789647","issue_url":"https://api.github.com/repos/pywinauto/pywinauto/issues/556","id":430789647,"node_id":"MDEyOklzc3VlQ29tbWVudDQzMDc4OTY0Nw==","user":{"login":"vasily-v-ryabov","id":7419086,"node_id":"MDQ6VXNlcjc0MTkwODY=","avatar_url":"https://avatars3.githubusercontent.com/u/7419086?v=4","gravatar_id":"","url":"https://api.github.com/users/vasily-v-ryabov","html_url":"https://github.com/vasily-v-ryabov","followers_url":"https://api.github.com/users/vasily-v-ryabov/followers","following_url":"https://api.github.com/users/vasily-v-ryabov/following{/other_user}","gists_url":"https://api.github.com/users/vasily-v-ryabov/gists{/gist_id}","starred_url":"https://api.github.com/users/vasily-v-ryabov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vasily-v-ryabov/subscriptions","organizations_url":"https://api.github.com/users/vasily-v-ryabov/orgs","repos_url":"https://api.github.com/users/vasily-v-ryabov/repos","events_url":"https://api.github.com/users/vasily-v-ryabov/events{/privacy}","received_events_url":"https://api.github.com/users/vasily-v-ryabov/received_events","type":"User","site_admin":false},"created_at":"2018-10-17T21:05:55Z","updated_at":"2018-10-17T21:05:55Z","author_association":"CONTRIBUTOR","body":"The right way is described in [hook_and_listen.py](https://github.com/pywinauto/pywinauto/blob/master/examples/hook_and_listen.py) example. For your case it should look so (if you need to press Enter inside Notepad or globally):\r\n\r\n```python\r\nimport win32api\r\nimport win32con\r\nfrom pywinauto.application import Application\r\nfrom pywinauto.win32_hooks import Hook\r\nfrom pywinauto.win32_hooks import KeyboardEvent\r\n\r\napp = Application().start('c:\\\\windows\\\\notepad.exe')\r\nmain_thread_id = win32api.GetCurrentThreadId()\r\n\r\ndef on_enter_press(args):\r\n    \"\"\"Callback for keyboard events\"\"\"\r\n    if isinstance(args, KeyboardEvent):\r\n        if args.current_key == 'Return' and args.event_type == 'key up':\r\n            app.notepad.menu_select('File -> Save').click()\r\n            win32api.PostThreadMessage(main_thread_id, win32con.WM_QUIT, 0, 0);\r\n\r\nprint(' press enter key once you done with typing')\r\nhk = Hook()\r\nhk.handler = on_enter_press\r\nhk.hook(keyboard=True) # there is a blocking message loop inside;\r\n# WM_QUIT exits this loop and continues execution of Python script\r\n```\r\nOf course, this code should work for the first Enter key press. If you need to handle all Enter keys, `WM_QUIT` should not be sent in the handler. So the script will never exit till explicit close of Python console.\r\n\r\nIf you need to wait for key press in Python console only (when it's in focus), this is the easiest way:\r\n```python\r\nimport msvcrt\r\nif msvcrt.getch() == '\\r': # e.g. Enter was pressed in Python console\r\n     app.notepad.MenuSelect('File -> Save').click()\r\n```"}}
{"actor":{"display_login":"vasily-v-ryabov"}}