Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
OSD
#1
I think LibreAutomate is pretty cool! But I am missing OnScreenDisplay which is available in QM.

Or did I overlook it?
#2
Code:
Copy      Help
osdText.showTransparentText("OSD");


You can find it the Cookbook panel: type OSD and click button "Find in recipe text" which is next to the search field.
#3
Thanks.

I would like to convert this QM script to a LA script:

Function mic_is_on
Code:
Copy      Help
int ticheck
rep
,int w=wait(-1 WV win("" "Shell_TrayWnd"))
,Acc a.Find(w "PUSHBUTTON" "Turn Dragon's Microphone Off" "class=ToolbarWindow32[]id=1504" 0x5 1)
,if a.NotFound
,,if ticheck =1
,,,OsdHide
,,,OnScreenDisplay "Dragon microphone is OFF" 2 0 -1 "Arial" 0 4 0xff0000
,,,ticheck=0
,else
,,if ticheck =0
,,,OnScreenDisplay "Dragon microphone is ON" -1 0 -1 "Arial" 0 4 0xff0000
,,,ticheck=1


How do I do that?
#4
How I would do that...

Probably at first would need to learn C# to the level to be able to create code structure like this (for, if/else, etc). Then in the Au library find functions for "wait for window", "find UI element", "OSD". For the first two there are tools.
#5
Code:
Copy      Help
// script ""
bool ticheck = false;
for (; ; ) {
    //code created with the 'Find UI element' tool
    var w = wnd.find(0, "", "Shell_TrayWnd");
    var e = w.Elm["BUTTON", "Turn Dragon's Microphone Off", "class=ToolbarWindow32"].Find();
    
    if (e == null) {
        if (ticheck) {
            osdText.closeAll();
            osdText.showTransparentText("Dragon microphone is OFF", 2, new(y: ^1), 0xff0000, new(22, "Arial"));
            ticheck = false;
        }
    }
else {
        if (!ticheck) {
            osdText.showTransparentText("Dragon microphone is ON", -1, new(y: ^1), 0x0000ff, new(22, "Arial"));
            ticheck = true;
        }
    }

    
    500.ms(); //hush the CPU fan
}
#6
Thank you! That works a treat.

I also noticed that this version has a much lower CPU footprint (virtually none :-)).


Forum Jump:


Users browsing this thread: 1 Guest(s)