Inconsistency when using Sikuli to recognize text - ocr

I'm using Sikuli to create automated tests for an application.
Text recognition is sometimes inconsistent so I have to use screen captures instead of text.
While trying to find a solution I found out that if I obtain the text in a specific region I get it correctly but then if I try to look for that obtained text on the screen Sikuli can't find it.
One example is trying to obtain and search for the menu "Users" in a menu bar using this code:
myregion = Region(51,24,51,16)
texto = myregion.text()
print("FOUND TEXT:")
print(text)
find(text).highlight(3)
The expected result is:
The text in the region is printed
The text is found and highlighted on the screen
But the actual result is that the text is not found by Sikuli.

There's currently an issue with text recognition. I've had the issue too. I've brought the issue to the author of the program and wont be fixed any time soon.

Related

How to create a rich text editor that returns html results in Flutter?

My goal is to create a rich text editor that returns html results. I am using the package flutter_quill. It can only return plain text using _controller.document.toPlainText() and json using _controller.document.toDelta().toJson(). I also tried html_editor_enhanced before. It has some problems. When I click the text color button and the dialog is shown, I can't press one of the colors in the horizontal color list. The mouse is always a text mouse and I can enter text despite the dialog being displayed in front of the text field. Although the dialog is blocked, I can still write behind the text field. Also, I am using web (Chrome) to run the app. Are there any other rich text editors that can return html results or any way to return html results in flutter_quill? Appreciate if someone can advise. Thank you in advance!
I finally found a solution!
I am using the following code to return html results:
final convertedValue = jsonEncode(delta.toJson());
final markdown = deltaToMarkdown(convertedValue);
final html = markdownToHtml(markdown);

Is it possible to discover that I used text expanders or I pasted text into a text box BEFORE sending my form?

I work writing messages on text boxes on a NON SECURE website interface of a company. I work from my pc and google chrome with no spy programs installed because i work from home on my own pc!
They do not want people to paste messages, but there are some words that I repeat a lot and I would like to use text expanders for those words or small expression.
My question is, is it possible that the company read and saves the keys that are digited on a text box BEFORE sending them the final message that I wrote?
Example, I could create a shortcut and use GDM to write Good Morning, is it possible that the company understand that I wrote GDM instead of good morning into the text box of that I pasted a word even if the final sent message will be Good Morning and not GDM? Will they be able to record my pressed keys like CTRL C and V or GDM instead of good morning?
Yes, It is possible to implement a javascript keylogger that logs every keystroke on that page. In your scenario the company would "benefint" from it, if they really want to detect pasting messages.
However this can be tricked by any application that calls the OS's native function that simulates the keystrokes and doesnt use keyboard shorcuts for the text expansion.

MS Access report to PDF cuts of some characters inconsistently

My print preview from MS Access shows everything perfectly fine. Here's the actual PDF file snapshot which shows some letters are cut in half. It happens inconsistently with this report and not always for the same data.
In this report only 5 out of 40 questions had their first letter cut in half.
Please advise.
I've tried adjusting where the data field must start, i.e. I've moved the start of the question a bit more right, but no difference.
Here's the design view I've highlighted in yellow where the question starts. I've moved it more right, makes no difference.
Here's where the user captures questions]
Your problem text lines have a stray Tab character (ASCII 9) at or near the beginning of the line, which is being interpreted as a lateral positioning move for the string. Your correct lines do not have a stray Tab. If you use Acrobat's text editor to delete the Tab, the rest of the line jumps properly into view.
Below, I've extracted the text of each line in your sample, and replaced the unexpected Tab character with an "X." If you use Acrobat text editing to navigate carefully to the spot in the line where the Tab is located (you won't see it directly, but it's there), Shift-cursor sideways to highlight the Tab alone, and delete it, you'll see the text revert to its normal appearance.
Note that the Tab is usually not the first character in the line, in lines where it appears:
SXources of polyunsaturated fats include
LXack of calcium is one of the major causes of osteoporosis
XDisaccharides are the simplest form of carbohydrate
Excessive long term protein intake may lead to kidney problems
Water soluble vitamins taken in excess have toxic effects in the body
LXack of calcium is one of the major causes of osteoporosis
SXources of polyunsaturated fats include
VXitamin B12 is involved in
I'm going to hazard a guess here that the problem was introduced in the text before it was uploaded to your final document, so that the unwanted Tabs somehow snuck in as body text. I hope that helps.
That is one weird effect. It is a bit suspicious that it only occurs towards the end of the document, but I have no idea what causes it.
Two workarounds worked for me:
1) Use
=" " & [Question]
as control source of the text box, and rename it to txtQuestion to avoid a circular reference. That's two spaces, one wasn't enough.
Move it a bit to the left, to make up for the increased indentation.
2) Don't use the Access-integrated PDF creator, use a PDF printer instead.
I used the Windows 10 integrated "Microsoft Print to PDF", but there are many free ones, e.g. https://en.pdf24.org/ (just google "pdf printer driver").
This created a larger .pdf file for me, but it doesn't show the error.
Edit: Interestingly, while Adobe Acrobat Reader shows the error, Foxit Reader or the Firefox integrated PDF viewer doesn't. Here is a single page example if anyone else wants to check.

Select item in dropdown list by taking the text from user

By taking user-input, search for the text in the dropdown. If exists, select it. Else, print: "the text is not present in dropdown".
In Sikuli, you have 2 ways to recognize textual data:
By taking a screenshot of the whole text and creating a pattern.
Use built in OCR features to find the text directly.
It is known however that OCR functionality is very limited and not reliable at the moment, hence the preferred solution is to take screenshot of every option you have in your dropdown menu. Then you can just click on the dropdown menu to display the options and then look for your pattern. If the item will be there, you will get a match if not, you know that it doesn't exist.
Assuming you have already saved you text as a pattern in a file, the code will be fairly simple:
find("dropDownMenu.png).click()
if exists("menuItem.png"):
click("menuItem.png") #not very efficient! Left for code simplicity.
else:
print "the text is not present in dropdown"

Scroll Multiple Text Fields using Action Script 3.0

I am trying to build a Flash application which would display data from a external source and scroll it from left to right.
I am new to action script world, i have found an example in which text is scrolling but here there is only one text field. I would like to have multiple text field depending upon my data loaded from external source. How can i achieve it. Do i need to create 10 text fields if my external data returns 10 records.
Any advice on this would be appreciated. Thanks
It depends on your task, if you need 10 lines of text information that moves independently, so you will need 10 text fields. Or you could scroll one text field and change it's content with a new information (next record). For scrolling of the text field you will need Timer or Enter frame handler or Tweening engine, as for changing text you will need some logic, like if text goes offscreen - show another text data.
For me, your question looks very similar to this one, check it, maybe it will be helpful for you.