Yesterday, 09:12 PM
Thanks for the help, I did a modification and it worked
The part that is not clear to me when I create the trigger,
When I create a trigger this below appears but I can not make it work... in QM was much easier
The part that is not clear to me when I create the trigger,
/// On Keypress Ctrl+Alt+s adds tray icon and stays running. If Total Commander if not running runs and exits.
/*/ ifRunning run; /*/
var w = wnd.find(@"*Total*", "*Total*", flags: WFlags.HiddenToo);
if (w.Is0) {
run.it(@"e:\D\totalcmd\TOTALCMD64.EXE");
} else if (w.IsVisible) {
script.trayIcon(0,
init: t => {
t.Icon = icon.ofWindow(w);
t.Tooltip = "Show Total Commander";
t.Click += e => { timer.after(30, _ => w.Activate()); };
}
);
w.Show(false);
try { w.WaitFor(0, w => w.IsVisible); } catch { }
} else {
w.Activate();
}
wnd.fin;
When I create a trigger this below appears but I can not make it work... in QM was much easier

using Au.Triggers;
partial class Program {
[Triggers]
void HotkeyTriggers() {
var hk = Triggers.Hotkey;
//Add hotkey triggers here.
//To add triggers can be used triggerSnippet or menu TT > New trigger.
//To add trigger scopes (window, program) can be used Ctrl+Shift+Q.
//Click the Run button to apply changes after editing.
//More info in Cookbook.
hk["Ctrl+Shift+T"] = o => Triggers.ShowTriggersListWindow();
hk["Ctrl+Alt+M"] = o => { print.it(o); };
hk["Ctrl+Alt+M"] = o => { print.it(o); };
hk.Last.EnabledAlways = true;
hk.Last.EnabledAlways = true;
if (!true) { //examples. To enable and test it, replace (!true) with (true) and run this script.
hk["Ctrl+Alt+K"] = o => print.it("trigger action example 1", o.Trigger); //it means: when I press Ctrl+Alt+K, execute trigger action print.it(...)
hk["Ctrl+Shift+F11"] = o => { //multiple statements
var w1 = wnd.active;
if (w1.Name.Like("* - Notepad")) keys.sendt("trigger action example 2\r\n");
else print.it("trigger action example 2");
};
hk["Ctrl+Shift+1"] = o => TriggerActionExample(); //call other function. To find it quickly, click the function name here and press F12.
hk["Ctrl+Shift+2"] = o => TriggerActionExample2(o.Window); //the function can be in any class or partial file of this project
hk["Ctrl+Shift+3"] = o => script.run("Script example1.cs"); //run script in separate process
hk["Ctrl+Shift+4", TKFlags.LeftMod | TKFlags.KeyModUp] = o => print.it("trigger with flags");
//triggers that work only with some windows (when the window is active)
Triggers.Of.Window("*Chrome", "Chrome_WidgetWin_1");
hk["Ctrl+F5"] = o => print.it("trigger action example 5", o.Trigger, o.Window);
//hk[""] = o => { };
// ...
Triggers.Of.Window(of: "notepad.exe"); //all windows of notepad.exe process
hk["Ctrl+F5"] = o => print.it("trigger action example 6", o.Trigger, o.Window);
//hk[""] = o => { };
// ...
// ...
Triggers.Of.AllWindows();
//disable or remap keys
//hk["CapsLock"] = o => { }; //just disable. Does not disable Ctrl+CapsLock etc.
//hk["?+Ins"] = o => keys.more.sendKey(KKey.Apps); //remap key. Also Ctrl+Ins etc. To remap keys, use keys.more.sendKey or keys.sendL, not keys.send.
//disable/enable triggers
hk["Ctrl+Alt+Win+D"] = o => ActionTriggers.DisabledEverywhere ^= true;
hk.Last.EnabledAlways = true;
}
}
void TriggerActionExample() {
print.it("trigger action example 3");
}
}