-
Notifications
You must be signed in to change notification settings - Fork 340
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
App.focus() on Windows not working with unicode characters in window title --- fixed 2019-03-05 build#220 #53
Comments
Could you paste the offending snippet exactly as you use it?
it is indeed implemented, but the code is in the bundled native lib written with C++. So it might have something to do with the unicode characters.
Not really. You might try to click on the app symbol in the taskbar. And of course you can find/click some part of the window, that is visible. |
confirmed: possible workaround: |
Thank you for quick reply. below is the my test code. I've tested with # -- coding: utf-8 -- heading but more got more strange result. below code was tested without # -- coding: utf-8 --
** Result** [error] App.focus failed: no window for [4668:Calculator.exe (CicMarshalWnd)] Calculator.exe Chrome.exe is running? True Chrome.exe focused ? Chrome.exe |
Not needed, since already set internally before script run. Does not have any influence on strings at script run, only tells the interpreter about the encoding of the script text. |
focus() always returns the App instance, but does not guarantee that it worked (currently no reliable check internally). so this does not really make sense:
To get all available info about an App instance, simply use
App has a rather verbose toString() implementation. |
Have a look at the Debug feature in the docs. For this test for example:
would have revealed enough information "voluntarily" ;-) |
... and for testing short snippets I have added the feature in the IDE, that allows to run only some lines of a larger script (right-mouse on a line number) |
... and finally: I have to do some digging, to find out, what can be done or wether it is not possible with the current App implementation. |
Thank you for your kind reply 🥇 |
Hey, gold medal ;-) In Germany we have a saying: As you shout into a forest, you get it back. It definitely is the more motivating when answering questions/complains the more the caller shows up with some effort to help me understand the problem and how it came up. All the best. |
Bad news: no quick fix, only a workaround. |
Pull request #82 might fix this one. But keep in mind, that if you want to find an App using the window title and the title contains Unicode characters you have to use a Unicode String literal. E.g. App.focus(u"Über.txt - Editor") or App(u"Über.txt - Editor"). focus(). |
Bug status
currently only workaround --- fix will take time (bug tracking)
Hi
I've just started to use Sikulix for my task.
I have tested sikulix 1.1.4 2018-11-27_13:43 (Build 137) on Windows 10.
When I tried to focus on app named with Unicode character, it failed with error "App.focus failed: no window for App_name_including_unicode_characters_and_English_also_PID"
I've reviewed Sikulix code and realised that switchApp method in org/sikuli/natives/WinUtil.java line 332 not implemented.
Probably because of this, focus() is not working?
Sorry I'm not actively using Java but Python.
Could you please fix this when you have time?
Also, is there any better way to work around to set focus on the app easily? I assume it can be done with fidn images but except this :)
The text was updated successfully, but these errors were encountered: