Cannot type slash character. This slash: "/"

Bug #525352 reported by André Pfitzner

This bug report was converted into a question: question #101902: Cannot type slash character. This slash: "/" --- workaround: alt + numpad.

10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
SikuliX
Invalid
Undecided
Unassigned

Bug Description

When I issue the command on the line 3 of my script:
    type("/")
The Sikuli IDE does not send the slash character ("/") and throw the following error:

[sikuli] [Error] source lineNo: 3
[sikuli] [Error] Traceback (innermost last):
  File "C:\DOCUME~1\ADMINI~1\CONFIG~1\Temp\sikuli-tmp8004614922768274155.py", line 3, in ?
  File "C:\Arquivos de programas\Sikuli\sikuli-ide-full.jar\Lib/python/edu/mit/csail/uid/Sikuli.py", line 514, 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:465)
 at edu.mit.csail.uid.SikuliScript.doType(SikuliScript.java:457)
 at edu.mit.csail.uid.SikuliScript.type_ch(SikuliScript.java:569)
 at edu.mit.csail.uid.SikuliScript.type(SikuliScript.java:626)
 at edu.mit.csail.uid.SikuliScript.type(SikuliScript.java:446)
 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

Thanks for the attention and congratulation for this very useful tools :)

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

This is not really a bug, since per definition the type() internally uses the american keyboard layout.

On my german Mac keyboard e.g. type("/") produces a - (hyphen). this is the corresponding key on the US keyboard.

You have 2 options:

1. use paste() instead of type() if the target of your typing is some kind of input field. it uses internally the clipboard and in this cases always produces the correct result. You can intermix paste() (typing text) and type() (pressing special keys).

2. find out, what would be produced with an US layout, if you press the key, that produces / with your actual layout. use this instead. (e.g. in my german example type("&") actually produces "/" or type("7", KEY_SHIFT)).

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

the type() problem with non-US keyboard layout is already in Progress
(https://bugs.launchpad.net/sikuli/+bug/511740)

Changed in sikuli:
status: New → Invalid
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.