← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #156443]: how to use the paste function to input chinese

 

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

    Status: Answered => Open

coldtest is still having a problem:
Today I download jython and  write a scrip to do the same thing as the jruby script. 
the jython script is :

# coding=utf-8
import sys

#print sys.getdefaultencoding() 
#reload(sys)
#sys.setdefaultencoding('utf-8')  
#print sys.getdefaultencoding() 

#print sys.path

from sikuli.Sikuli import *

switchApp("C:\Program Files\Internet Explorer\IEXPLORE.EXE")
wait("D:\\script\\jy\\img\\url_input.png",10) 
paste("D:\\script\\jy\\img\\url_input.png","http://www.google.com.hk";)
sleep(2)
type(Key.ENTER)
sleep(3)
#seach_key = unicode('梅西','gbk')
seach_key = u'梅西'
paste("D:\\script\\jy\\img\\key_search.png",seach_key)
click("D:\\script\\jy\\img\\search_button.png",0)
sleep(3)
closeApp("Google");

I save the script file as UTF-8 ,if I don't do this ,I must meet a error:
D:\script\jy>jython test.py
  File "<string>", line None
SyntaxError: Illegal character in file 'test.py' for encoding 'utf-8'

after I save the script as UTF-8 ,I can run the script successly ,but I also met the same problem as jruby ,
It is distorted Character Code which was inputed in google search .  and I can't search the correct result.  hope for you help ,thanks .

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