3

I am using Sikuli to complete some forms and I have to type Greek letters on some of them.

I can define a string with greek letters, for example a='Γεια σου', and even print it using Python 3.5.2 Shell (on Windows). However when I use the type command on SikuliX the program crashes. The paste command does not give error but does not type the correct word either (it types other symbols).

Is there any way to type the correct Greek letters? (couldn't find anything in Google)

Added later: I noticed that typing ALT+(a number 896-919) gives Greek capital letters. I tried this with KeyDown(Key.ALT) on Sikuli but it doesn't work - it types nothing.

stavros11
  • 31
  • 3
  • This question doesn't seem programming-related (but please correct me if I'm wrong about that); so it might be a better fit for our sister site, [Super User](http://superuser.com). – ruakh Jul 02 '16 at 23:49
  • Looks like you made a good effort in trying all the options. Using `type` definitely wouldn't work because it can only use characters from a standard US keyboard. I would expect `paste` to work however. Can you say what character were you expecting to type and what what typed instead with `paste`? I see why the last option wouldn't work. The only thing I can think of is that you are not doing `KeyUp(Key.ALT)` when you're done typing the code. Can you try that and get back with the result? – Eugene S Jul 03 '16 at 05:56
  • @ruakh I'm not sure, it has to do with a program but it might not be exactly a programming question. I didn't know about the other site. – stavros11 Jul 03 '16 at 09:01
  • @Eugene S: About the ALT method, I did `KeyUP(Key.ALT)` and it didn't work (I just didn't mentioned it above). About the characters, I want to be able to type all the Greek capital letters. I defined `a='ΑΒΓΔΕΖ...ΦΧΨΩ'` (whole alphabet in capital) and after pasting in a notepad with Sikuli, I get `ÎÎÎÎÎÎÎÎÎÎÎÎÎÎÎΠΡΣΤΦΧΨΩ`. I thought that it has to be something ASCII-related but I don't understand why different letters correspond to the same symbol. – stavros11 Jul 03 '16 at 09:07
  • 1
    **UPDATE (solution?):** I think I found it [here][1]. If I use `paste(ucode('ΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤΦΧΨΩ'))` I get the correct result in the notepad. Haven't tried in the program I want yet, but I think it will work since it worked in the notepad. [1]: https://answers.launchpad.net/sikuli/+question/260734 – stavros11 Jul 03 '16 at 09:29
  • If that works, post it as an answer to your question and accept it. – Eugene S Jul 04 '16 at 01:07

1 Answers1

0

As stavros11 already noted, https://answers.launchpad.net/sikuli/+question/260734 holds the solution.

Here is a small sample script:

openApp("notepad.exe")
find("1470067652176.png") #set focus to notepad window
paste(unicode("Δ δ", "utf-8"))
paste(ucode("Δ δ"))
Bookeater
  • 474
  • 1
  • 7
  • 12
  • It is not working in latest version: [error] NoMethodError ( (NoMethodError) undefined method `unicode' for main:Object ) – plaidshirt Jan 15 '19 at 10:10