text() is being temperamental

Asked by Nomis Carr

Hey there (using Sikuli r930 and Windows Vista 32 bit.)

I'm trying to determine the number of rows withing a table in Microsoft Word 2000.
I was originally:
right click the table
click table properties
click rows
take the text() of the rows using the following code.

click("TablePgopert.png")

click("Column.png")
click("Row-1.png")

start = find("Rows1.png")
rows = start.right(12).text()
click("OK.png") or click("Cancel.png")
print rows

this was effective for some numbers, however for the numbers 13, 21 and 30; text() failed utterly.
even defining the region didn't work:
Region(x,y,w,h).text()

Is there any way to determine the total number of rows in this table?
Another method i experimented with was exists(image below end of table) and ending a loop but it would often fail.

Many thanks

Australia

Question information

Language:
English Edit question
Status:
Answered
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
RaiMan (raimund-hocke) said :
#1

You might try with the new version 1.0.1, which has some slight enhancements with the text() feature, but I do not really want you to be very hopeful though :-(
If you do:
take care to select the Tesseract option and switch on the OCR feature in IDE or via Settings.

Currently: if a text cannot be read, it cannot be read ;-)

There are some tricks/hacks (temporarily increase screen magnification, find the pattern of errors and correct accordingly, ...) but I think, usually the effort does not pay off.

Revision history for this message
RaiMan (raimund-hocke) said :
#2

for version 1.0.1 start here:
http://www.sikulix.com/download.html

Revision history for this message
obiwan-92 (obiwan-92) said :
#3

Hello !

Like RaiMan said, the OCR is not very effective.

But you can use your clipboard :
when you have selected your row properties :
type('a', KeyModifier.CTRL) # to select all
type('c', KeyModifier.CTRL) # send it to the clipboard
row = Env.getClipboard()

I don't test it but, it should be work ;-)

Regards

Revision history for this message
RaiMan (raimund-hocke) said :
#4

@obiwan
LOL, exactly -- did not think about that, but now it is registered ;-)

Can you help with this problem?

Provide an answer of your own, or ask Nomis Carr for more information if necessary.

To post a message you must log in.