[1.1.x] Invalid key code when ":" included in a string with type() --- request: should be possible

Bug #513312 reported by Roberto Ruisánchez
50
This bug affects 11 people
Affects Status Importance Assigned to Milestone
SikuliX
Fix Released
Medium
RaiMan

Bug Description

Trying the following code:
type("cd C:\\temp\\\r");
The result is:
[sikuli] type: 'cd C:\temp\
' +0
[sikuli] [Error] source lineNo: 2
[sikuli] [Error] Traceback (innermost last):
  File "C:\DOCUME~1\ADMINI~1\CONFIG~1\Temp\sikuli-tmp3784144668038766078.py", line 2, in ?
  File "C:\Archivos de programa\Sikuli\sikuli-ide-full.jar\Lib/python/edu/mit/csail/uid/Sikuli.py", line 403, in type
 at sun.awt.windows.WRobotPeer.keyPress(Native Method)

 at java.awt.Robot.keyPress(Unknown Source)

 at edu.mit.csail.uid.SikuliScript.doType(SikuliScript.java:409)

 at edu.mit.csail.uid.SikuliScript.doType(SikuliScript.java:410)

 at edu.mit.csail.uid.SikuliScript.doType(SikuliScript.java:401)

 at edu.mit.csail.uid.SikuliScript.type_ch(SikuliScript.java:504)

 at edu.mit.csail.uid.SikuliScript.type(SikuliScript.java:542)

 at edu.mit.csail.uid.SikuliScript.type(SikuliScript.java:390)

 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

 at sun.reflect.NativeMethodAccessorImpl.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

I am using Windows XP (Spanish) and Sikuli latest version.

Tags: fkt-type
Revision history for this message
Tsung-Hsiang Chang (vgod) wrote :

':' is fine. The problem is on '\r'.

Changed in sikuli:
status: New → Fix Committed
Revision history for this message
Roberto Ruisánchez (ruisan) wrote :

I am not so sure about that. If I try the following script:

openApp("cmd")
type("cd c:\\temp\\")

The result is the same error, and this is the output in the console:

Microsoft Windows XP [Versión 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

C:\Archivos de programa\Sikuli>cd c

So it seems like it is not able to process the ":" character.

Changed in sikuli:
status: Fix Committed → In Progress
Revision history for this message
Gregor Kopka (mailfrom-launchpad-net) wrote :

Is there a chance of a release which fixes this?

Problem is still in 0.10.0 running on Windows XP Pro SP3

Revision history for this message
Tsung-Hsiang Chang (vgod) wrote :

I think this is due to the keyboard layout you were using. Sikuli assumes QWERTY.
You can use paste instead of type to solve this problem.

Changed in sikuli:
status: In Progress → Won't Fix
Revision history for this message
Thibault Joassard (t-joassard) wrote :

Hello,
Is this case still on "won't fix" status? Is there a way to choose the keyboard layout?

Thanks

Revision history for this message
RaiMan (raimund-hocke) wrote :

@ Thibault
I have set this back to "in progress", since I have an idea, how to "learn" a different keyboard layout in Sikuli.
No plan yet, when it is ready though.

meanwhile look faq 933 and some related questions on type()

Changed in sikuli:
status: Won't Fix → In Progress
assignee: nobody → RaiMan (raimund-hocke)
summary: - Invalid key code when ":" included in a string
+ Invalid key code when ":" included in a string with type()
RaiMan (raimund-hocke)
tags: added: fkt-type
RaiMan (raimund-hocke)
Changed in sikuli:
importance: Undecided → Low
RaiMan (raimund-hocke)
Changed in sikuli:
importance: Low → Wishlist
Revision history for this message
Alessandro Capello (alessandro-capello-it) wrote : Re: Invalid key code when ":" included in a string with type()

@ Roberto

To type the symbol ":" you have to replace each occurence with ">".

for example:

C>\\temp

This isn´t very nice but it will grant you the possibility to run your test. I hope this will be fixed in any version.

A possible Idea to fix this Issue would be a parameter, which will set the input type of the keyboard.

// Example.sikuli
Setting.keyboardLayout(it)
...
following Testcode in which the keyboardLayout will be used

Revision history for this message
Ken Su (side-place) wrote :

Any chance we gonna have this feature? As it's in wishlist now, maybe I can make a wish as well?

Revision history for this message
RaiMan (raimund-hocke) wrote :

will only be available in version 2, since there is no generally available solution for all platforms.

Changed in sikuli:
importance: Wishlist → Medium
milestone: none → 2.0.0
summary: - Invalid key code when ":" included in a string with type()
+ [1.1.x] Invalid key code when ":" included in a string with type() ---
+ request: should be possible
Revision history for this message
Jeevanand Kuharaj (jkuharaj) wrote :

I recently upgraded my test system from Sikuli 1.1.1 to 1.1.4 and since then I have a strange issue with the following code:
type("r", KeyModifier.WIN)

it seems to work just fine on its own but when used later in the code it causes a java.lang.IllegalArgumentException Key: Not supported character: r

I've also tried:
type('r', KeyModifier.WIN)
type("r", Key.WIN)
type('r', Key.WIN)

keyDown(Key.WIN)
type("r")
keyUp(Key.WIN)

they all fail.

What could cause this? I haven't change the part of my code in question since upgrading and it always worked just fine with 1.1.1

Revision history for this message
Jeevanand Kuharaj (jkuharaj) wrote :

Really strange, I worked around the issue by using openApp instead of using the Run window, but now it fails _earlier_ when I want it to open the File menu in our application (German: Datei) by using "type('d', KeyModifier.ALT)" with the message:
java.lang.IllegalArgumentException: Key: Not supported character: d

I have no clue what is causing this and why and when it happens. And I don't want to work around every key combo as in this case it's one of the points of testing, if the menu responds to key combos. Is there a limit how big a script can be?

Any ideas on how to debug it?

RaiMan (raimund-hocke)
Changed in sikuli:
status: In Progress → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.