← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #218078]: type() foreign symbol example

 

Question #218078 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/218078

    Status: Open => Answered

RaiMan proposed the following answer:
This is principally, what you have tried.
But it only works, if you have a foreign (not en-us) layout active while running the script, to produce the characters you see on your keyboard using type().
So i can produce an ö via type(), by typing a [
The mentioned solution is a procedure to "learn" the foreign keyboard and to produce the translation table.

What you are looking for is a solution, to produce characters that are
NOT on your keyboard.

And there I come back to j-th-k's suggestion based on the alt-nnn solution.
so e.g ö is alt-0246

the solution:
german = { u"ä", "0228", u"ö", "0246", u"ü", "0252"  }

def type_ger(line):
    for letter in line:
        nums = german.get(letter, ""))
        if nums == "":
            type(letter)
            return
        keyDown(Key.ALT)
        for n in nums:
            eval( "type(Key.NUM" + n + ")" )
        keyUp()

type_ger(u"Flöte")

-- 
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.