• Post Reply Bookmark Topic Watch Topic
  • New Topic

Special character help.  RSS feed

 
Mojster Jaka
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello everyone. I follow this forum for 4 months now. I am learning Java very slowly and i stumped on a problem i can't solve with forum or google. So please help.

Here is my code that works (it clicks on screen and writes some text (ALALA) and presses enter):



I am having no problem at all when i don't have special characters like (ČĆŠŽÄ) Example:



NetBeans gives me error:

run:
[log] CLICK on L(362,328)@S(0)[0,0 1920x1200]
[info] Write: Ä

Exception in thread "main" java.lang.IllegalArgumentException: Cannot convert character Ä
at org.sikuli.script.Key.toJavaKeyCode(Key.java:692)
at org.sikuli.script.RobotDesktop.typeChar(RobotDesktop.java:360)
at org.sikuli.script.Region.write(Region.java:4074)
at javaapplication1.JavaApplication1.main(JavaApplication1.java:33)
Java Result: 1
BUILD SUCCESSFUL (total time: 2 seconds)

I use Sikuli

If i understand correctly problem lies in sikuli, but i not skilled enough to find solution.

Can anyone help me?
 
Jason Bullers
Ranch Hand
Posts: 115
11
Clojure IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you have a look at the javadoc, you'll see some information that seems to confirm your thought that it's a "problem" with Sikuli. It looks like the write() and type() methods use some special syntax to simulate typing on a keyboard. I would assume that for this reason, they don't support any sort of extended character set that includes special characters.
 
Mojster Jaka
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you for looking in my problem. Is there any workaround, i just don't have enough knowledge to change library or find another solution.

Is there posibility in java that i can set text in clipboard and then just use sikuli to paste it? Will that override the write() function in matter of sendig special characters?
 
Tony Docherty
Bartender
Posts: 3271
82
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've never used Sikuli but from a quick look at the docs in link provided by Jason it looks like the write method allows you to enter codes to build up combination key strokes such as CTRL+ALT+A so if you know the keystrokes required (presumably from a US QWERTY keyboard as that appears to be the only keyboard mapping that is supported) to get the character you want to input you may be able to fudge the input that way. Not an ideal solution I grant you but it may work.
 
Campbell Ritchie
Marshal
Posts: 56518
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
… and welcome to the Ranch
 
Mojster Jaka
Greenhorn
Posts: 9
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi!

Thanks for all responses. But i just stoped complicating things and i just used


To copy text to clipboard and then i paste it with sikuli.

@Tony: i tried your sugestion but it doesn't work. Thanks for the idea.
 
Tony Docherty
Bartender
Posts: 3271
82
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for updating the thread with a working solution.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!