Navigation

    TRIGGERcmd
    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    1. Home
    2. Strahan
    S
    • Profile
    • Following
    • Followers
    • Topics
    • Posts
    • Best
    • Groups

    Strahan

    @Strahan

    0
    Reputation
    10
    Posts
    516
    Profile views
    0
    Followers
    0
    Following
    Joined Last Online

    Strahan Follow

    Posts made by Strahan

    • RE: Need to send CMD to already CMD window

      Sorry for the late reply. This is a Windows install, right? I bought Rust so I could test it. I setup a dedicated server and was able to send commands to the server. I made a video showing how I did it: https://www.youtube.com/watch?v=EQ-CmU2h_10

      Basically, I just set a title on the Rust server window then did like sendtocmd "title" "rust command" /d:5. The /d is delay between each character. I found that while it works fine in Minecraft, for Rust it drops characters because it sends too fast. So I added a /d switch to pass how many milliseconds between each character to pause. 5ms seems to work good for me.

      Updated SendToCmd file

      posted in Windows
      S
      Strahan
    • How do I subscribe?

      Hi. I used TriggerCMD a couple years ago but my need for the functionality was abated so I stopped using it. I now have need again, so I installed the agent. Plugged in my token it said I need to resubscribe. So I went to the site's control panel and I can't find anywhere that one does this.

      Can you point me in the right direction? Thanks!

      posted in General Discussion
      S
      Strahan
    • RE: Need to send CMD to already CMD window

      I can't speak for if TriggerCMD has that functionality, but I had to do that once to send commands to a Minecraft server window. I Googled around and found C# code that will send text to an existing command window. Here is the code:

      using System;
      using System.Collections.Generic;
      using System.Windows.Forms;
      using System.Runtime.InteropServices;
      using System.Text;
      
      namespace SendToCMD {
        static class Program {
          [DllImport("user32")]
          [return: MarshalAs(UnmanagedType.Bool)]
          public static extern bool EnumChildWindows(IntPtr window, EnumWindowProc callback, IntPtr i);
          [DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)]
          static extern int GetClassName(IntPtr hWnd, System.Text.StringBuilder lpClassName, int nMaxCount);
          [DllImport("user32.dll", SetLastError = true)]
          static extern IntPtr FindWindow(string lpClassName, string lpWindowName);
          static IntPtr hWnd = FindWindow(null, "Untitled - Notepad");
          [DllImport("user32.dll", SetLastError = true)]
          static extern bool PostMessage(IntPtr hWnd, [MarshalAs(UnmanagedType.U4)] uint Msg, IntPtr wParam, IntPtr lParam);
          [DllImport("user32.dll", SetLastError = true)]
          static extern bool PostMessage(IntPtr hWnd, [MarshalAs(UnmanagedType.U4)] uint Msg, int wParam, int lParam);
      
          const int WM_KEYDOWN = 0x0100;
          const int WM_KEYUP = 0x0101;
          const int WM_CHAR = 0x0102;
          public static IntPtr cmdHwnd = IntPtr.Zero;
      
          [STAThread]
          static void Main(string[] args) {
            if (args.Length < 2) Environment.Exit(1);
      
            string windowToAttach = args[0];
            string commandToSend = String.Join(" ", args, 1, args.Length-1);
      
            IntPtr child = FindWindow(null, windowToAttach);
            StringBuilder sb = new StringBuilder(100);
            if (child.ToString() == "0") return;
      
            GetClassName(child, sb, sb.Capacity);
            if (sb.ToString() != "ConsoleWindowClass") return;
      
            uint wparam = 0 << 29 | 0;
            string msg = commandToSend;
            int i = 0;
            for (i = 0; i < msg.Length; i++) PostMessage(child, WM_CHAR, (int)msg[i], 0);
            PostMessage(child, WM_KEYDOWN, (IntPtr)Keys.Enter, (IntPtr)wparam);
            cmdHwnd = child;
          }
      
          public static List<IntPtr> GetChildWindows(IntPtr parent) {
            List<IntPtr> result = new List<IntPtr>();
            GCHandle listHandle = GCHandle.Alloc(result);
            try {
              EnumWindowProc childProc = new EnumWindowProc(EnumWindow);
              EnumChildWindows(parent, childProc, GCHandle.ToIntPtr(listHandle));
            } finally {
              if (listHandle.IsAllocated)
                listHandle.Free();
            }
            return result;
          }
      
          private static bool EnumWindow(IntPtr handle, IntPtr pointer) {
            GCHandle gch = GCHandle.FromIntPtr(pointer);
            List<IntPtr> list = gch.Target as List<IntPtr>;
            if (list == null) {
              throw new InvalidCastException("GCHandle Target could not be cast as List<IntPtr>");
            }
            list.Add(handle);
            return true;
          }
      
          public delegate bool EnumWindowProc(IntPtr hWnd, IntPtr parameter);
        }
      }
      

      If you aren't familiar with C#, here is the compiled version if you want to try it. You just need to pass it the window title then whatever commands you want it to run. Like on my MC server I have a batch file like:

      @echo off
      setlocal
      set windowTitle="Spigot 1.16.4"
      sendtocmd %windowTitle% time set 1200 imperial
      sendtocmd %windowTitle% mgctrl spleef reset
      sendtocmd %windowTitle% mgctrl spleef annc Spleef arena reset, ready for next game!
      
      posted in Windows
      S
      Strahan
    • RE: Backup settings

      Thanks. Only outbound? That's curious. So when I use my IFTTT webhook trigger with Alexa to turn my bedroom fan on, it doesn't send a packet to my agent from your system to let it know to activate?

      posted in General Discussion
      S
      Strahan
    • RE: Backup settings

      Thanks!

      PS: The reason I have to rebuild the machine is it was compromised. I implemented IP filters on my firewall so only my cellphone and family systems can access my server. The communications from your service; is there an IP range I can use to whitelist it?

      posted in General Discussion
      S
      Strahan
    • Backup settings

      Hi. I need to reformat the machine I have TRIGGERcmd installed in. Where does it save its settings so I can back it up? I'd rather not have to recreate all the triggers. Thanks.

      posted in General Discussion
      S
      Strahan
    • RE: Can't get things to trigger

      This is a bit late, lol, but thanks. Got that all working now so I can be in bed and say "alexa, trigger windy 15" and have my fan turn on for fifteen minutes only. So nice :) Used to be I could turn it on with Alexa but it would run until I turn it off, so I'd fall asleep and wake up frozen hehe.

      Thanks!

      posted in General Discussion
      S
      Strahan
    • Can't get things to trigger

      Hi. I want to be able to lie in bed and say "alexa, trigger fan 15" and have it run a batch that will turn the fan in the bedroom off in fifteen minutes. But just to start simple, I made a batch file that just plays a WAV file so I can test the connectivity. Installed TriggerCMD agent on my pc named "Zaranth". As that's a mouthful and i was afraid Alexa may interpret the weird word oddly, I set voice trigger for that PC to game as it's my gaming rig. I created a command "noisy" that runs \misc\triggercmd\noise.bat. If I hit the green "trigger" button for that command when viewing the list of triggers, it works perfectly.

      So I said "alexa, ask trigger c m d to run noisy on game" (figured I'd make sure it worked native before throwing IFTTT into the mix). No dice. It won't see it, said it cannot find that command. I can't figure out what's wrong. Any idea?

      https://www.youtube.com/watch?v=rgMJyKXx1zQ

      posted in General Discussion
      S
      Strahan
    • RE: Voice words / parameters

      Thanks. The generic usage method looks fine. I wouldn't think that a movie or whatever specific parameter would really be necessary; the people creating their commands will know what kind of input to expect and will handle it accordingly.

      I guess for now I'll just make "codewords" that do specific functions, heh. That'll work for now. Thanks again!

      posted in General Discussion
      S
      Strahan
    • Voice words / parameters

      Hi! I just bought an Echo tonight, and the deciding factor was that I could control my PC when I Googled and saw your program. I've been playing with it, it's cool. However, I have one snag. I wanted to be able to launch videos from it, so I created a trigger "Die Hard", command was the path and filename of the video, voice was "die hard". I pronounced it as clearly as I could but it keeps saying "cannot find command die". Does it not support multiple word voice commands? I changed it to "die" and it worked.

      Also I was trying to find documentation on parameters and failing. Can you direct me? I'm wondering if I can create a command that is generic then pass parameters that I assume I say after the trigger word to launch the appropriate title. I just can't find any docs on how parameters work.

      I setup a trigger "video", with command "p:\utils\scripts\triggercmd.php video", voice "video" allow parameters true. My PHP script looks for parameter "diehard". I said "alexa, ask trigger c m d to run video diehard" and it said "could not find a command with voice word video hard on (pcname)". Am I misinterpreting how to use parameters?

      posted in General Discussion
      S
      Strahan