1. Next program version will have a function in class ScriptEditor. Now can be used this:
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".
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:
/// <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:
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:
// 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.