Typing colons with windows

Asked by j

When I want to type text using type("text"), and the text contains "::", the script stops with an illegal key exception thrown from somewhere within the java robot.
This happens only with windows (windows7, 32bit, java 6), linux (ubuntu 11.10, 32bit, java6) works fine.
Could this be some kind of keyboard-layout issue? I don't know what else it could be or how to work around it.
I also don't know if this happens only with two colons or also with one, I always tried it with two.

How I can reproduce it:
1. Open any editor or GUI with a textfield.
2. Write type("test::test") into the Sikuli-IDE
3. Execute Script. The Script will type test and then stop with the exception.

I need a workaround for this, and if possible one without paste()

Question information

Language:
English Edit question
Status:
Answered
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
j (j-the-k) said :
#1

If I change my keyboard from German to English layout, the problem seems to be solved.
In addition, if I change it from German to English and back, sometimes there is no illegal key exception but it prints some strange symbols instead of the :: but not always the same ones.

I still would prefer a workaround to type :: on a german keyboard layout, but I don't know how to do this.

Revision history for this message
j (j-the-k) said :
#2

So windows 7 seems to have one keyboard layout for every application.

If I change the sikuli-ide-layout to German, I always get this:

[error] Fehlermeldung: Traceback (most recent call last):
File "C:\Users\KadeMa\AppData\Local\Temp\sikuli-tmp6334737993898198610.py", line 3, in
type("test:test")
at sun.awt.windows.WRobotPeer.keyPress(Native Method)
at java.awt.Robot.keyPress(Unknown Source)
at org.sikuli.script.DesktopRobot.doType(DesktopRobot.java:111)
at org.sikuli.script.DesktopRobot.typeChar(DesktopRobot.java:118)
at org.sikuli.script.Region.type(Region.java:809)
at org.sikuli.script.Region.type(Region.java:789)
at sun.reflect.GeneratedMethodAccessor42.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)

java.lang.IllegalArgumentException: java.lang.IllegalArgumentException: Invalid key code

If Sikuli-IDE has US layout and the program Sikuli types into has German layout, there are things like ü instead of a colon.

If Sikuli-IDE and the program Sikuli types into both have US layout, the colons can be typed normally.

I also found out that the problem appears with only one colon, too.

Still looking for a nice workaround that does neither include change keyboard layouts all the time and nor paste(). Suggestions are welcome.

Revision history for this message
RaiMan (raimund-hocke) said :
#3

type() is fixed to the keyboard layout eng-US.

no solution for this currently.

Can you help with this problem?

Provide an answer of your own, or ask j for more information if necessary.

To post a message you must log in.