jarmo / RAutomation

RAutomation
MIT License
100 stars 33 forks source link

MsUia: Internationalization #66

Closed emmakun closed 6 years ago

emmakun commented 11 years ago

It would be very useful to have full support for non-ASCII (i.e. UTF-8) characters for locating controls and windows.

In particular, when you use the MsUia adapter and try to open a menu, only the :text locator is allowed, which means that if the text is in a language different of english, it will fail to get the control.

At least it would be fine to get a workaround to this by allowing to use another locator, like :id, this way it could be possible to define a list of values (or a hash) with the name of the menu and its AutomationID to get the right control.

Something like:

...

FILE_MENU = "123"
SUBMENU = "456"

RAutomation.window(title: /myapp/i, adapter: :ms_uia).menu(id: FILE_MENU).menu(id: SUBMENU).open

...
leviwilson commented 11 years ago

The only :id that I think :ms_uia would be able to support would be the AutomationId, not the menu id. If you use UISpy to inspect a menu item, there isn't a whole lot of information available to identify it. But I definitely see the issues with using :ms_uia with UNICODE character sets. All of the UiaDll.dll methods take char*, and in ffi it defines them as :string. I've not used wchar_t * with ffi before, but I can probably take a stab at it.

emmakun commented 11 years ago

That would be great, and yes, I think it could also be helpful to add the AutomationId as a locator and use UISpy to get that value for the menu.

jarl-dk commented 11 years ago

:+1:

jarmo commented 6 years ago

Closing this due to inactivity.