Comments (12)
confirmed:
does not work, if window title contains unicode character.
possible workaround:
use a compound part of the window title, that does not contain any unicode characters.
from sikulix1.
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:
new_app = app_instance.focus()
print("%s focused ? %s " % (app_instance.getName(), new_app.getName()))
To get all available info about an App instance, simply use
print "myApp:", myApp
App has a rather verbose toString() implementation.
from sikulix1.
Could you paste the offending snippet exactly as you use it?
switchApp method in org/sikuli/natives/WinUtil.java line 332 not implemented
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.
Also, is there any better way to work around to set focus on the app easily?
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.
from sikulix1.
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 --
def check(app_instance):
print("%s is running? %s" % (app_instance.getName(), app_instance.isRunning()))
print("%s has window? %s" % (app_instance.getName(), app_instance.hasWindow()))
new_app = app_instance.focus()
print("%s focused ? %s " % (app_instance.getName(), new_app.getName()))
calculator = App("Calculator.exe")
check(calculator)
chrome = App("Chrome.exe")
check(chrome)
** Result**
Calculator.exe is running? True
Calculator.exe has window? True
[error] App.focus failed: no window for [4668:Calculator.exe (CicMarshalWnd)] Calculator.exe
Calculator.exe focused ? Calculator.exe
Chrome.exe is running? True
Chrome.exe has window? True
Chrome.exe focused ? Chrome.exe
from sikulix1.
-- coding: utf-8 -- heading
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.
from sikulix1.
Have a look at the Debug feature in the docs.
For this test for example:
Debug.on(3)
calc = App("Calculator.exe")
calc.open()
calc.focus()
would have revealed enough information "voluntarily" ;-)
from sikulix1.
... 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)
from sikulix1.
... 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.
from sikulix1.
Thank you for your kind reply π₯
from sikulix1.
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.
from sikulix1.
Bad news: no quick fix, only a workaround.
See #53 (comment)
from sikulix1.
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().
from sikulix1.
Related Issues (20)
- sikulixIDE 2.0.x ImportError HOT 1
- VS Code extension for SikuliX scripts HOT 1
- Is there a way to generate long clicks (10 seconds +) on actionable elements? HOT 2
- Screen.click(pattern) returns FindFailed error right after screen.has(pattern) returned true. HOT 2
- Latest sikulix1api library contains dependencies with reported security vulmeralibilies
- OCR(region.text()) is detecting wrong text, when text is underlined HOT 6
- Write access to repository's wiki HOT 1
- Wiki cannot be checked out in windows HOT 2
- Exception in thread "Thread-22" java.lang.ExceptionInInitializerError HOT 9
- How to connect database influxdb HOT 1
- Problem with transparency
- Easy way to ignore the background for image search? --- use images with transparent background HOT 7
- IDE: Preview does not work or ends up in a Java crash
- The "Region.findAnyCollect" method maybe cause an endless loop
- Unable load script from command line HOT 1
- java.lang.NullPointerException HOT 4
- Using SikuliX1 from a SWT thread
- java.lang.ExceptionInInitializerError: null
- When using VNCScreen, the screen is not refreshing.
- How to get working on Windows 10?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sikulix1.