Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
OCR-Image
#27
HTTP server is a fast and powerful way to call LA functions.
https://www.libreautomate.com/forum/show...p?tid=7468
https://www.libreautomate.com/forum/show...5#pid36755

Or create .exe program from script. QM can execute it without LibreAutomate. Slower, but maybe simpler.

The example script will be an exe script.

Creating .exe program

In LibreAutomate create new script.
In Poperties select role exeProgram, fill outputPath, OK.
Later click the Compile button whenever you want to create or update .exe program.

Creating OCR code

Click toolbar button or menu item "Find OCR text".
Select the target window or control with hotkey F3. Test, OK.
More info in the OCR tool window.

Script example
 
Code:
Copy      Help
// script "OCR example.cs"
/*/ role exeProgram; outputPath C:\Test\OCR example; /*/

var w = wnd.find(1, "Test", "CabinetWClass");
var c = w.Child(1, id: 100); // SysTreeView32 "Navigation Pane"
var t = ocr.find(1, c, "Test");
t.MouseClick();

You can replace some strings etc with command line parameters args[0], args[1]...
The script can return a number to indicate errors.
 
Code:
Copy      Help
// script "OCR example.cs"
/*/ role exeProgram; outputPath C:\Test\OCR example; /*/

//if (script.testing) {
//    args = new[] { "Test", "CabinetWClass", "Test" }; //window name, class, and text to find
//}


try {
    var w = wnd.find(1, name: args[0], cn: args[1]);
    var t = ocr.find(1, w, text: args[2]);
    t.MouseClick();
    return 0;
}

catch (Exception e) { print.it(e); return 1; }

Calling from QM

Macro Macro3257
Code:
Copy      Help
str cl=
;"Test" "CabinetWClass" "Test"
int ec=run("C:\Test\OCR example\OCR example.exe" cl "" "" 0x30400)
out ec


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)