Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Triggers, event log viewer
#1
Hello,
Still transitioning from QM to LA
is there a way to view log of events, there there is in QM?
Is there a trigger for changes made to a window/control? like change of name or "become visible" like in QM?

Thank you as always
#2
Quote:is there a way to view log of events, there there is in QM?
In LA no. You can find it in the Start menu (type to search).
 
Quote:Is there a trigger for changes made to a window/control? like change of name or "become visible" like in QM?
Look in Cookbook panel >Triggers and toolbars. To make a "change of name" trigger, add a "visible" trigger and use parameter later. Example:

Code:
Copy      Help
        Triggers.Window[TWEvent.Visible, cn: "QM_Editor", flags: TWFlags.RunAtStartup, later: TWLater.Name] = o => {
            if (o.Later is TWLater.Name) {
                print.it("name changed", o.Window);
            }
else {
                print.it("visible", o.Window);
            }
        };
#3
Quote:In LA no. You can find it in the Start menu (type to search).

Hi Again
Are you referring to this event logger in windows:
https://flic.kr/p/2r8Gj8V
How do I programmatically make events there become triggers in LA?
#4
Yes. Use the Windows Task Scheduler. Directly or via LA: menu TT > Script launchers > Schedule > Schedule > Event log.
#5
Hello again,
Is it possible to also have triggers for specific acc objects? similar to how there was in QM? I don't see the option when I use the menu bar tool in LA for specific acc obj (menu TT > Script launchers > Schedule > Schedule > Event log)
#6
Use class `WinEventHook`.

If you want to use it in the `@Triggers and toolbars` process (together with your keyboard/mouse/autotext/window triggers), a good place for the code is file `Other triggers`, or a file like it in the same folder. To open or create-open the file, click menu `TT > Other triggers`.

Example. A function in file `Other triggers`.
 
Code:
Copy      Help
    //this function runs at startup, and sets one or more UI element event hooks
    [Triggers]
    void WinEventTriggers() {
        var hook = new WinEventHook(EEvent.SYSTEM_FOREGROUND, 0, x => {
            //this code runs when an UI object event occurs (in this case - a window activated)
            print.it(x.event_, x.w);
            //var e = x.GetElm();
            //print.it(e);

        });
        
        //example for multiple events
        var hook2 = new WinEventHook([EEvent.SYSTEM_MINIMIZESTART, EEvent.SYSTEM_MINIMIZEEND], x => {
            print.it(x.event_, x.w);
            //var e = x.GetElm();
            //print.it(e);

        });
        
    }

This can be useful to discover events. Run as a separate script.
Code:
Copy      Help
// script "Log UI element events.cs"
print.clear();

var wLa = wnd.find(0, "LibreAutomate", "HwndWrapper[Au.Editor;*");
var wLaOutput = wLa.Child(0, "Output_text", "Scintilla");
int i = 0;
using var hook = new WinEventHook(EEvent.MIN, EEvent.MAX, x => {
    //skip some unwanted events
    if (x.w == wLaOutput) return;
    if (x.idObject == EObjid.CURSOR) return;
    //if (x.event_ == EEvent.OBJECT_LOCATIONCHANGER) return; //example - skip an event type
    
    print.it(++i, x.event_, x.w);
    //var e = x.GetElm();
    //print.it(e);

}, flags: EHookFlags.SKIPOWNPROCESS);
dialog.show("Logging UI element events", "Close me to stop.");
 
[/code]
#7
Much appreciated!


Forum Jump:


Users browsing this thread: 1 Guest(s)