← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #252621]: Automate using text not image

 

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

    Status: Open => Answered

Mark Weisler proposed the following answer:

On Aug 4, 2014, at 11:36 AM, Anunaya wrote:

> New question #252621 on Sikuli:
> https://answers.launchpad.net/sikuli/+question/252621
> 
> Hi 
> 
> I am trying a automate a tool using sikuli which has some 100 test cases which I used to execute manually. I tried  automating using images but this seems to be very hectic & there are times that sikuli does not get the correct image because there might appear some pop and the script fails. 
> 
> I want to automate using text. I have learnt that OCR can be used to automate using text. But can't really figure out how to use it or rather how to import it in skuli. 
> 
> Can you please help?
> 
> -- 
> You received this question notification because you are an answer
> contact for Sikuli.
> 


Here's a short illustration on how to get text from a region.
You have to be careful to ensure the region is visible and in focus.


# this script illustrates one way to use text
myReg= Region(100,100,500,600)   # to define and set a region to examine

myReg.highlight(2)   # highlight the region for 2 seconds to confirm we are looking at the right area
myText = myReg.text() # get the text from my region and put the text into myText
print myText

You could branch your script execution based on the value of myText.

-- 
Mark Weisler  PGP Key ID 68E462B6
PGP Key fingerprint  87D5 A77B FC47 3CC3 DFF0  586D 23FF F8B4 68E4 62B6

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