Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to compile trigger to exe?
#1
Hi,
I want to compile a trigger file to exe file. But it doesn't work. Is there anything wrong? Thank you so much!
Code:
Copy      Help
[code]// class "Hotkey triggers.cs"
/*/ role exeProgram; outputPath %folders.Workspace%\exe\Hotkey triggers; /*/
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.

        
        
        
        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("* WordPad", "WordPadClass");
            
            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 => {  };
            
            hk["Ctrl+Shift+Enter"] = o =>keys.send("Home Enter");
            // ...
            Triggers.Of.Window("* - Jupyter Notebook - *", "Chrome_WidgetWin_*");
            hk[" Ctrl+,"] = o => keys.more.sendKey(KKey.Down); //just disable. Does not disable Ctrl+CapsLock etc.
            hk[" Ctrl+j"] = o => keys.more.sendKey(KKey.Left); //just disable. Does not disable Ctrl+CapsLock etc.
            hk[" Ctrl+l"] = o => keys.more.sendKey(KKey.Right); //just disable. Does not disable Ctrl+CapsLock etc.
            hk[" Ctrl+i"] = o => keys.more.sendKey(KKey.Up); //just disable. Does not disable Ctrl+CapsLock etc.
            
            // ...

            
            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");
    }
    
}

[/code]


Messages In This Thread
How to compile trigger to exe? - by birdywen - 09-21-2023, 12:25 PM
RE: How to compile trigger to exe? - by burque505 - 09-21-2023, 01:06 PM
RE: How to compile trigger to exe? - by Gintaras - 09-21-2023, 04:10 PM
RE: How to compile trigger to exe? - by birdywen - 09-21-2023, 08:17 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)