dubravcik / pbixrefresher-python

Refresh Power BI reports programmatically for free
MIT License
125 stars 55 forks source link

type_keys() won't work with named keys, eg {VK_TAB} #25

Closed NicciBamf closed 5 years ago

NicciBamf commented 5 years ago

I'm using pbixrefresher to automate refresh of a PBI report, which works perfrectly, however I also need to save a data table as a csv file, by copying the table into excel and then saving as csv since the table is too large to export as csv in PBI (circa 60k rows). I can get pywinauto to go to the data view in PBI but I then need to use Shift+TAB to highlight the table and bring up the Copy Table option. From looking at the information available on pywinauto I believe that type_keys("+{VK_TAB}",win) is what I need to use to do this, however I get the following error message: pywinauto.keyboard.KeySequenceError: '}' not found

I have tried {TAB}, as well as different bracket types and no brackets but none of these work (using no brackets gave no error but nothing happened).

NicciBamf commented 5 years ago

With the help of Stack Overflow I realised what I was doing wrong, which was using type_keys("{VK_SHIFT down}{VK_TAB}{VK_SHIFT up}",win) When I tried win.type_keys("{VK_SHIFT down}{VK_TAB}{VK_SHIFT up}") it worked. Although I actually felt that the following worked better. win.click_input(button = 'right')
Closing this now as not an issue with pbixrefresher, but hopefully this will help someone else in the future.