• Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Register
  • Login
TRIGGERcmd
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Register
  • Login

How to use Off Command

Instructions
10
28
50.7k
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R
    Russ @Terry Ap
    last edited by Russ Sep 14, 2020, 9:19 PM Sep 14, 2020, 9:18 PM

    @Terry-Ap, this is already available in the latest version of the Windows agent. I'm having trouble with the Mac version and I haven't started trying to build the Linux version yet. I hope to finish those soon. Maybe within a couple weeks.

    Russell VanderMey

    1 Reply Last reply Reply Quote 0
    • R
      Rob Lee
      last edited by Feb 21, 2021, 6:25 AM

      Russ - is this working in windows currently or no? i see you said above that it is - but the option is still grayed out for me. I've updated the agent and everything, so just trying to figure out if there's an issue on my end or if it's just not ready.

      R 1 Reply Last reply Feb 21, 2021, 6:01 PM Reply Quote 0
      • R
        Russ @Rob Lee
        last edited by Russ Feb 21, 2021, 6:02 PM Feb 21, 2021, 6:01 PM

        @Rob-Lee, the "Off Command" field is greyed out if "Allow Parameters" is set to false.

        Allow Parameters has to be true if you want to use the Off Command field.

        I'm glad you asked, because it's not particularly intuitive.

        Russell VanderMey

        1 Reply Last reply Reply Quote 0
        • D
          DJ
          last edited by Feb 24, 2021, 5:25 AM

          On Windows 10. I tried this example and when I asked Alexa to "turn on calculator" it failed. I had to ask "turn Calculator on" for it to work. no biggie there. But when I said "turn Calculator off" it opened another instance of calculator and said as much in reply from my Echo show. What's the issue?

          R 1 Reply Last reply Feb 24, 2021, 11:43 PM Reply Quote 0
          • R
            Russ @DJ
            last edited by Feb 24, 2021, 11:43 PM

            @DJ, if you want to do something else when you tell Alexa/Google to turn the virtual device off, you need to populate the Off Command field set Allow Parameters to true.

            In this screenshot you'll see I'm closing calculator when Alexa turns the device off.

            fd859d0a-2fb3-46ad-8a61-3dacd62fc674-image.png

            Russell VanderMey

            D 1 Reply Last reply Jan 11, 2022, 12:18 PM Reply Quote 0
            • D
              David Jones @Russ
              last edited by Jan 11, 2022, 12:18 PM

              @russ Works like a charm .. a newbee to this.
              Now how to send a voice/ text back to my Google Nest Mini.

              David Jones MVP
              Microsoft WinHEC/IoT/Embedded/App Development MVP
              https://github.com/djaus2
              https://mvp.microsoft.com/en-us/PublicProfile/5000301?
              @IOTMaestro

              D 1 Reply Last reply Jan 25, 2022, 5:16 AM Reply Quote 0
              • D
                David Jones @David Jones
                last edited by Jan 25, 2022, 5:16 AM

                @david-jones I am using Cast from Windows. Chasing equivalent for RPi on Raspian.

                David Jones MVP
                Microsoft WinHEC/IoT/Embedded/App Development MVP
                https://github.com/djaus2
                https://mvp.microsoft.com/en-us/PublicProfile/5000301?
                @IOTMaestro

                1 Reply Last reply Reply Quote 0
                • T
                  Tobias Knabe
                  last edited by Dec 10, 2022, 1:12 PM

                  This post is deleted!
                  1 Reply Last reply Reply Quote 0
                  • ?
                    A Former User
                    last edited by Oct 22, 2023, 11:41 AM

                    Hi,
                    I'm trying to set up a command "Turn ON Monitors" and "Turn OFF monitors" for Alexa.
                    Am I doing something wrong here? Doesn't work.

                    Thank you
                    ebf46b7a-3eae-4097-98fc-872cbb95410f-image.png

                    R 1 Reply Last reply Oct 22, 2023, 12:42 PM Reply Quote 0
                    • R
                      Russ @A Former User
                      last edited by Russ Oct 22, 2023, 12:46 PM Oct 22, 2023, 12:42 PM

                      @David-0, what you show in that screenshot looks correct, assuming nircmd.exe is in that "c:\local apps\nircmd" folder. It's good you quoted the full path because it contains a space.

                      Do those commands work if you run them locally in a powershell or cmd window? I suppose the monitor on command would be difficult to type if the monitor is off, but you could press the up arrow and delete the two f's and add an n and press enter.

                      Also, what if you run them from the website, like from your phone? Does that work? If not, you should troubleshoot that before moving on to Alexa (or Smart Things). When you're ready to move on, please check for this page to make sure it shows the "on" Alexa phrase. If it's not there, something is wrong, like maybe your computer isn't your default computer or it doesn't have a voice word set (which you only need to set if it's not your default computer).

                      I've had pretty good luck with nircmd but some monitors don't respond to nircmd's on/off commands, so you'll want to test the monitor off command manually first.

                      Russell VanderMey

                      ? 1 Reply Last reply Oct 22, 2023, 3:59 PM Reply Quote 0
                      • ?
                        A Former User @Russ
                        last edited by A Former User Oct 22, 2023, 4:02 PM Oct 22, 2023, 3:59 PM

                        @Russ Hi
                        Thanks for your continuous support.

                        1. Yes, the commands work from the website, triggered from my phone
                        2. I have separated both commands.
                          0d9091a9-b468-4f38-b69f-58c7cbf15eb1-image.png
                        • I've changed the "Monitors ON" command to sendkeypress to see if it works better than monitors on.
                        • Now, Both commands work fine from the website AND from Alexa as well.
                        • The "Nircmd monitor on" command still doesn't work for some reason (hence I changed to sendkeypress)
                        • It also doesn't work if I use the "Off Command" option in your Windows App, I apparently have to make 2 separate commands.

                        Thanks a lot! Sorry for my many questions, I'm just starting with TRIGGERcmd.
                        Until now, I was using ACC (AssistantComputerControl) and IFTTT in my Alexa routines but as of 31 October, IFTTT won't be available in Alexa anymore in the UK so I needed to switch to something else.
                        Money well spent on TRIGGERcmd!!

                        R 1 Reply Last reply Oct 23, 2023, 12:48 PM Reply Quote 1
                        • R
                          Russ @A Former User
                          last edited by Russ Oct 23, 2023, 12:49 PM Oct 23, 2023, 12:48 PM

                          @David-0 nice job. Good idea using the space to turn the monitor back on.. I'm not sure why nircmd won't do it.

                          I wonder why the IFTTT Alexa skill is going away in the UK.

                          Russell VanderMey

                          ? 1 Reply Last reply Oct 23, 2023, 7:59 PM Reply Quote 0
                          • ?
                            A Former User @Russ
                            last edited by Oct 23, 2023, 7:59 PM

                            @Russ Because Amazon are upgrading their API on November 1st. They've been notifying all devs about this but IFTTT being either lazy or stupid, they haven't updated their systems so on November 1st, they will become incompatible with Amazon new API.

                            R 1 Reply Last reply Oct 25, 2023, 3:03 PM Reply Quote 0
                            • R
                              Russ @A Former User
                              last edited by Oct 25, 2023, 3:03 PM

                              David, good to know. Also sorry you lost your forum account. I didn't realize it would go away when you disconnected you Google account.

                              Russell VanderMey

                              XanderX 1 Reply Last reply Feb 26, 2024, 6:59 PM Reply Quote 0
                              • Emanoel Matheus lima da silva souzaE
                                Emanoel Matheus lima da silva souza
                                last edited by Dec 23, 2023, 10:29 AM

                                fala portuges

                                1 Reply Last reply Reply Quote 0
                                • XanderX
                                  Xander @Russ
                                  last edited by Xander Feb 26, 2024, 8:43 PM Feb 26, 2024, 6:59 PM

                                  @Russ I'm trying to setup an on/off command for some services. The PC is x86 so I'm just editing the JSON file.

                                  Here's the line inside the JSON:
                                  {"trigger":"Remote","command":"C:\Users\STICK10\Documents\SC on.bat","offCommand":"C:\Users\STICK10\Documents\SC off.bat","ground":"foreground","voice":"Remote","voiceReply":"Okay","allowParams":"true" },

                                  When I try to trigger it, it's only running the SC ON batch file, not the OFF. What's my error? Or do I need to set these as two different commands altogether?

                                  Inside TCMD's cmd window:
                                  { trigger: 'Remote',
                                  id: '____',
                                  params: 'on' }
                                  Running trigger: Remote Command: C:\Users\STICK10\Documents\SC on.bat
                                  Reported: Command Ran

                                  { trigger: 'Remote',
                                  id: '____',
                                  params: 'off' }
                                  Running trigger: Remote Command: C:\Users\STICK10\Documents\SC on.bat
                                  Reported: Command Ran

                                  R 1 Reply Last reply Feb 26, 2024, 10:57 PM Reply Quote 0
                                  • R
                                    Russ @Xander
                                    last edited by Russ Feb 26, 2024, 11:00 PM Feb 26, 2024, 10:57 PM

                                    @Xander, I just tried sending "off" with this commands.json entry and it worked for me.

                                     {
                                      "trigger": "Remote",
                                      "command": "C:\\Users\\STICK10\\Documents\\SC on.bat",
                                      "offCommand": "C:\\Users\\STICK10\\Documents\\SC off.bat",
                                      "ground": "foreground",
                                      "voice": "",
                                      "voiceReply": "",
                                      "allowParams": "true"
                                     }
                                    

                                    This was my output:

                                    { trigger: 'Remote', id: '___', params: 'off' }
                                    Running trigger: Remote  Command: C:\Users\STICK10\Documents\SC off.bat
                                    Reported: Command Ran
                                    

                                    So maybe you're using a old version of the agent from before I added the logic to use the offCommand field. I know you're running in on an x86 Windows box, so you're not running the normal agent. You can probably just update the agent.js file.

                                    Russell VanderMey

                                    XanderX 1 Reply Last reply Feb 26, 2024, 11:18 PM Reply Quote 0
                                    • XanderX
                                      Xander @Russ
                                      last edited by Xander Feb 27, 2024, 2:55 AM Feb 26, 2024, 11:18 PM

                                      @Russ That's probably it. The agent.js has a date stamp of Nov 2017. Closed tcmd, updated from your link (old was 23kb, new is 348kb. Quite the diff!)

                                      But, on starting the batch file, I get an "unexpected token" error. It also overwrote my .json file but it was mostly the line above so I'll redo it if I need to. Swapped the old .js back and it runs so something is amiss.

                                      SyntaxError: Unexpected token <
                                          at createScript (vm.js:80:10)
                                          at Object.runInThisContext (vm.js:139:10)
                                          at Module._compile (module.js:599:28)
                                          at Object.Module._extensions..js (module.js:646:10)
                                          at Module.load (module.js:554:32)
                                          at tryModuleLoad (module.js:497:12)
                                          at Function.Module._load (module.js:489:3)
                                          at Function.Module.runMain (module.js:676:10)
                                          at startup (bootstrap_node.js:187:16)
                                          at bootstrap_node.js:608:3
                                      
                                      R 1 Reply Last reply Feb 27, 2024, 1:59 PM Reply Quote 0
                                      • R
                                        Russ @Xander
                                        last edited by Feb 27, 2024, 1:59 PM

                                        @Xander, the latest version of agent.js is about 23k. Maybe try again to download it? Or look at the one you have maybe there's a clue what's wrong with it. It shouldn't be that big.

                                        Russell VanderMey

                                        XanderX 1 Reply Last reply Feb 27, 2024, 10:39 PM Reply Quote 0
                                        • XanderX
                                          Xander @Russ
                                          last edited by Feb 27, 2024, 10:39 PM

                                          @Russ D'oh. The link here showed it went to ...node.js so I downloaded from here but now it's clear that it was a page about it so I've DL'd it properly 🤦🏻‍♂️
                                          That's back up and running.

                                          Question, though. I switched the command to use SCHTASKS to run a job of the same batch files to circumvent any UAC issues but SCoff doesn't work in either bat or task form. The cmd window -says- it's being called but no window is called. Any ideas?

                                          [
                                             {"trigger":"Users","command":"schtasks.exe /run /tn users","ground":"foreground","voice":"users"},
                                             {"trigger":"Connect","command":"schtasks.exe /run /tn SCon","ground":"background","voice":"connect"},
                                             {"trigger":"Disconnect","command":"schtasks.exe /run /tn SCoff","ground":"background","voice":"disconnect"},
                                             {"trigger":"Remote","command":"schtasks.exe /run /tn SCon","offCommand":"schtasks.exe /run /tn SCoff","ground":"foreground","voice":"Remote","voiceReply":"Okay","allowParams":"true" },
                                             {"trigger":"Reboot","command":"shutdown /r /t 10","ground":"foreground","voice":"reboot"}
                                          ]
                                          

                                          In case I would need them as separate commands, I created the Connect/Disconnect commands which I think are fine but they don't show in the TCMD trigger page at all.

                                          R 1 Reply Last reply Feb 28, 2024, 1:23 PM Reply Quote 0
                                          • First post
                                            Last post