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

Bug #513312 reported by Roberto Ruisánchez on 2010-01-27
This bug affects 9 people
Affects Status Importance Assigned to Milestone

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.

Tsung-Hsiang Chang (vgod) wrote :

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

Changed in sikuli:
status: New → Fix Committed
Roberto Ruisánchez (ruisan) wrote :

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

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

Is there a chance of a release which fixes this?

Problem is still in 0.10.0 running on Windows XP Pro SP3

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
Thibault Joassard (t-joassard) wrote :

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


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) on 2013-02-21
tags: added: fkt-type
RaiMan (raimund-hocke) on 2013-02-21
Changed in sikuli:
importance: Undecided → Low
RaiMan (raimund-hocke) on 2013-02-21
Changed in sikuli:
importance: Low → Wishlist

@ Roberto

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

for example:


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
following Testcode in which the keyboardLayout will be used

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?

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
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers