Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Questions About LibreAutomate
#1
Hi, I'm migrating from qm 2 to LibreAutomate and finding it amazing, and I have some questions.

1. On qm2 I have a key to show or hide in tray (shutdown -3|-4), is there a way to do it on LibreAutomate.
2. It is possible to trigger when a window close, I didn't find it.
3. Some keys don't work as triggers, like (' \ / | ), is there a way to use them?
4. Is there a way to change the color of the icons of folders and scripts? I'm daltonic and both seem the same color, with a lot of files and folders it becomes a bit confusing.
5. Is there or will have a way to add shell menu.
6. I don't know if this is a bug, if you right-click on a piece of code and "Go to definition", the window go to background, but pressing F12 it gets the focus.
#2
1. Next program version will have a function in class ScriptEditor. Now can be used this:
 
Code:
Copy      Help
        hk["Ctrl+Win+A"] = o => { var w = wnd.findFast("LibreAutomate"); if (w.IsVisible) w.Close(noWait: true); else wnd.findFast(cn: "Au.Editor.TrayNotify").Post(0x8001, 0, 0x202); };

2. Use a "window visible" trigger with flags "run at startup" and "later destroyed".
 
Code:
Copy      Help
        Triggers.Window[TWEvent.VisibleOnce, "*- Notepad", "Notepad", flags: TWFlags.RunAtStartup, later: TWLater.Destroyed] = o => { if (o.Later == TWLater.Destroyed) print.it("closed", o.Window); };

Maybe this function can make it easier:
 
Code:
Copy      Help
    /// <summary>
    ///
Adds trigger "window closed".
    /// Parameters are the same as of window triggers or <see cref="wnd.find"/>.
    /// </summary>
    ///
<param name="action">Trigger action.</param>
    ///
<inheritdoc cref="wnd.find" path="/param"/>
    ///
<example>
    ///
<code><![CDATA[
    /// _AddTrigger_WindowClosed(o => { print.it("closed"); }, "*- Notepad", "Notepad");
    /// ]]></code>
    ///
</example>
    void _AddTrigger_WindowClosed(Action<WindowTriggerArgs> action, string name = null, string cn = null, WOwner of = default, Func<wnd, bool> also = null, WContains contains = default) {
        Triggers.Window[TWEvent.VisibleOnce, name, cn, of, also, contains, TWFlags.RunAtStartup, TWLater.Destroyed] = o => { if (o.Later == TWLater.Destroyed) action(o); };
    }

3. All keys should work. Maybe these hotkeys are used by some other program. To test I used this code:
 
Code:
Copy      Help
        hk["Ctrl+'"] = o => { print.it(o); };
        hk["Ctrl+/"] = o => { print.it(o); };
        hk["Ctrl+|"] = o => { print.it(o); };

4. Currently can change only icons of selected files and folders. In the Icons dialog. In the future the program should allow to change icons of file types (script, class, folder).

5. Not in near future.

In many cases shell menus can be replaced with a toolbar attached to File Explorer folder windows. Example:
 
Code:
Copy      Help
// class "Toolbar_Explorer.cs"
using Au.Triggers;

partial class Program {
    [
Toolbars]
    void Toolbar_Explorer_Triggers() {
        Triggers.Window[TWEvent.ActiveOnce, null, "CabinetWClass", "explorer.exe"] = Toolbar_Explorer;
    }

    
    void Toolbar_Explorer(WindowTriggerArgs ta) {
        var t = new toolbar();
        //t.Anchor = TBAnchor.TopRight;
        
        t["Copy path"] = o => { clipboard.text = string.Join("\r\n", _SelPaths()); };
        t.Menu("Menu", t => {
            var a = _SelPaths();
            if (a != null && a.Length > 0) {
                var s = a[0];
                //rejected. Notepad++ adds itself to the shell context menu.
                //t["Open with Notepad"] = o => _Open(folders.System + @"notepad.exe");
                //t["Open with Notepad++"] = o => _Open(folders.ProgramFiles + @"Notepad++\notepad++.exe");

                
                if (0 != s.Ends(true, ".dll", ".exe")) {
                    t["Dependencies"] = o => _Open(@"C:\Program Files\Dependencies\DependenciesGui.exe");
                    t["Hex edit"] = o => _Open(folders.LocalAppData + @"HHD Software\Hex Editor Neo\HexFrame.exe");
                    t["PEview"] = o => _Open(@"C:\Program Files\PEview\PEview.exe");
                    
                    t.Separator();
                }

                
                void _Open(string program) {
                    foreach (var v in a)
                        run.it(program, $"\"{v}\"");
                }
            }

            
            t["Show folder sizes"] = o => script.run(@"\My\Rare\Show folder sizes.cs", _FolderPath(), "1");
            
        });

        
        ////auto-hide. Above is the auto-hide part. Below is the always-visible part.
        //t = t.AutoHide();
        //if (t.FirstTime) {
        
        //}

        
        t.Show(ta);
        
        string _FolderPath() => ExplorerFolder.Of(ta.Window).GetFolderPath();
        
        string[] _SelPaths() => ExplorerFolder.Of(ta.Window).GetSelectedItems();
    }
}

6. I see this with the "github search" window. Will fix it, thanks.
#3
Thanks for the help, but for some reason I still cannot make all the keys work, changing the keyboard layout fixed some of them but not all.
#4
Run this script and press keys. It prints key names. Use them in triggers.

Code:
Copy      Help
using var hook = WindowsHook.Keyboard(k=> {
    if(!k.IsUp) print.it(k.Key, keys.more.keyToString(k.Key));
},
ignoreAuInjected: false);
dialog.show("Hook");
#5
Thanks, now i'ts working great.


Forum Jump:


Users browsing this thread: 2 Guest(s)