← 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: Answered => Open

Muro is still having a problem:
@ j-the-k
thank you.

@ RaiMan
Can you give us example of your use here:

--- This is read into a key-value storage using clipboard (by eval()) and analyzed.
--- " \ and the diacritic characters (´`^~¨) need special handling
--- The result is a key-value storage, containing for all 256 extended ASCII characters the equivalents that have to be used with type(), to get the character you want.
--- So I am able to fully utilize my german keyboard and type() every text, that can be produced with this keyboard (since I use JRuby, it is easy to redefine the Region.type() method (actually it is the type_ch() method, that contains the translation), to use this "german" translation table)
--- I am using YAML to store and reload the tables

i`m newbie in python i`ll try with dictionary but it return all array:

def type_ger(line):
    for letter in line:
	    type_german(letter)
        
def type_german(letter):
    return { 	 
        
            'ü': type('['),
	    'ö': type(';'),
	        }[letter]
click(Pattern("pic.png").targetOffset(-151,53))
type_ger('ü') 

it works
but it return all symbol from array and break with error:

[error] Stopped
[error] An error occurs at line 14
[error] Error message: Traceback (most recent call last):
 File "C:\Users\User\AppData\Local\Temp\sikuli-tmp2204018246795003748.py", line 14, in 
 type_ger('ü') 
File "C:\Users\User\AppData\Local\Temp\sikuli-tmp2204018246795003748.py", line 3, in type_ger
 type_german(letter)
 File "C:\Users\User\AppData\Local\Temp\sikuli-tmp2204018246795003748.py", line 6, in type_german
 return { 
KeyError: Ã

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