10-04-2023, 06:38 PM
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
You can replace some strings etc with command line parameters args[0], args[1]...
The script can return a number to indicate errors.
Calling from QM
Macro Macro3257
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
// 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.
// 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
