Note that there are some explanatory texts on larger screens.

plurals
  1. POMODI MiSelectRects gets coordinates wrong
    text
    copied!<p>I have a Windows Form app that, when executed, launches Firefox, grabs the process and handle of the window, and does a screen capture of Firefox, saves it to disk (temp.bmp) and calls ProcessGetWindow. I'm basically using MiSelectRects in MODI to capture the rectangle around the word that I'm looking for, and then I use AutoIT to mouse click on the word.</p> <p>The problem is that my coordinates are off by about 10 pixels from the top.</p> <p>Any ideas what might be wrong? Here's the function that does the processing. I have commented out the AutoIT processing, and I'm just debugging with a MessageBox to show me the actual coordinates. I then confirm with AutoIT's Window Info tool and it's definitely off... am I doing something wrong or is there something screwed up with MODI?</p> <pre><code>public void ProcessGetWindow(Bitmap image) { Document modiDoc = null; MiDocSearch modiSearch = null; IMiSelectableItem modiTextSel = null; MiSelectRects modiSelectRects = null; MiSelectRect modiSelectRect = null; MiRects modiRects = null; int intSelInfoPN; string intSelInfoTop; int intSelInfoBottom; string intSelInfoLeft; int intSelInfoRight; // Load an existing image file. modiDoc = new Document(); modiDoc.Create(@"C:\\temp.bmp"); // Perform OCR. modiDoc.Images[0].OCR(); // Search for the selected word. modiSearch = new MiDocSearch(); modiSearch.Initialize(modiDoc, "Click Me", 0, 0, false, false); modiSearch.Search(null, ref modiTextSel); try { modiSelectRects = modiTextSel.GetSelectRects(); } catch (COMException) { MessageBox.Show("Me thinks that the OCR didn't work right!"); } foreach (MiSelectRect mr in modiSelectRects) { //intSelInfoPN = mr.PageNumber.ToString(); intSelInfoTop = mr.Top.ToString(); //intSelInfoBottom = mr.Bottom; intSelInfoLeft = mr.Left.ToString(); //intSelInfoRight = mr.Right; /*AutoItX3 auto = new AutoItX3(); auto.AutoItSetOption("MouseCoordMode", 2); auto.MouseClick("", intSelInfoLeft, intSelInfoTop, 1, 80);*/ MessageBox.Show("Coordinates: " + intSelInfoLeft + ", " + intSelInfoTop, "Coordinates", MessageBoxButtons.OK); } //string textResult = modiTextSel.Text; //MessageBox.Show(textResult, "Search Results", MessageBoxButtons.OK); // Close this dialog. Application.Exit(); } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload