Navigation

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

    Best posts made by Russ

    • API call to list your commands on each computer

      @davboc asked me for a way to produce a list of his commands. I gave him an API call to use, and he came up with this python script that takes the output and makes it nice and readable. I thought it was pretty cool so I'm sharing it here:

      import subprocess
      
      string=subprocess.check_output(["curl -k -X POST https://www.triggercmd.com/api/command/commandlist -H 'Authorization: Bearer (your token from Instructions page)'"],stderr=subprocess.STDOUT,shell=True).strip()
      
      array=string.decode().split('"name":')
      array.pop(0);
      for a in array:
          print a.split('"')[1].strip()
      

      The output looks like this:

      Downstairs > Calculator
      Downstairs > Delete browse history
      Downstairs > Launch a website
      Downstairs > Notepad
      Downstairs > Rebooting in 10 seconds
      Downstairs > Volume Down
      Downstairs > Volume Up
      Garage > Betsy Garage Door
      Garage > Reboot
      Garage > Russ Garage Door
      Garage > apt update
      Garage > boot russfam
      Laptop > Calculator
      Laptop > Delete browse history in Internet Explorer
      Laptop > Down Arrow
      Laptop > Email my document list
      Laptop > Launch a website
      Laptop > Lock my PC
      Laptop > Play mp3's in your Music folder
      Laptop > Reboot
      Laptop > Update Windows
      MintNAS > Gnome Editor
      MintNAS > Reboot
      MintNAS > apt update
      MintNAS > yum update
      RussFam > Backup Documents
      RussFam > Calculator
      RussFam > Dropbox
      RussFam > Email my document list
      RussFam > Michael Jackson Thriller Album
      RussFam > Mute

      posted in General Discussion
      Russ
    • Type out your parameters

      I can say:

      • Alexa, ask TRIGGERcmd to run Type This with parameter I am the coolest

      And my computer will type "I am the coolest" wherever my cursor happens to be.

      Create c:\tools\typeit.vbs with these contents:

      Dim Wsh
      Set Wsh = Wscript.CreateObject("Wscript.Shell")
      
      Set args = Wscript.Arguments
      
      For Each arg In args
        Wsh.SendKeys arg
        Wsh.SendKeys " "
      Next
      

      Then create a command in TRIGGERcmd like this with parameters turned on:

      wscript c:\tools\typeit.vbs
      

      TRIGGERcmd runs your commands super fast, so if you're testing this on the computer where the agent is running and using the Parameters button on the website, you can add a 5 second pause at the beginning of the script with this command. That should give you enough time to click another window before it types your parameters in that window.

      WScript.sleep 5000
      posted in Windows
      Russ
    • How TRIGGERcmd came to be

      It all started when my house got robbed. I was frustrated by my cheap video cameras because I had video of the thief coming and going, but the quality was too low to provide many useful clues. The police probably could have identified the bad guy sooner if I'd had better video.

      On my low res cameras I could see this guy leaving my house with my headphones, bike, hat, shoes, clothes, and a backpack full of valuables. He tracked mud all over my house and even took the time to take a shower. :rage:
      Thief

      Here he is in the backyard, hiding from my camera before he snuck around and disconnected it. You can see the resolution is not very good.
      Thief on his way in

      So I went on a tech shopping spree and upgraded my video surveillance system to HD and invested in a Samsung SmartThings based alarm system with presence sensors, motion sensor, door sensors, and a device that sounds the alarm if someone disconnects a camera. The thief disconnected a camera before he broke in, so I figured that device was worth installing.

      One downside of an alarm system is the false alarms. Just last night I had one when I got back home from the bar after midnight. I don't drink, but I was hanging out with my kickball team after our game (we lost). To quickly turn off the alarm I setup a secret light switch that turns off my alarm when you flip it. At first I couldn't find a way to do that with a SmartThings SmartApp, so I used an IFTTT trigger.

      I'd heard of IoT (internet of things) before all this, but I thought it was a marketing fluff (which it is), so I wasn't too interested, but using SmartThings and IFTTT for practical purposes piqued my interest and got my geek juices flowing. However, I realized one THING was missing from IoT - it was my PC.

      About a year prior, I had published a few games, but I was looking for something else to build because I was spending too much time on these games and they weren't making me any money. A couple of them have been downloaded around 5000 times on the Amazon app store,
      Amazon Apps list 5-20-2017

      ... but my ad revenue is still less than $200 even though my games have served over 1.1 million ads.

      AdRevenueVsPageViews

      So I was looking for a non-game idea that's not too ambitious because I wanted to be able to finish it.

      In my research I found Sails.JS which introduced me to websockets, which I thought was super cool because it lets the client interact with the server instantly. That's why modern real-time chat apps use it. While testing various websocket clients and servers I learned that Node.JS can run javascript code as a client and/or as a server. The Sails.JS server runs on Node.JS and has a javascript module for the client. This Sails.JS client module usually runs in the browser, but it can also run in other client apps, like the TRIGGERcmd agents.

      When I learned about Electron, the TRIGGERcmd idea started to form. Electron adds a GUI to Node.JS to produce a cross-platform GUI application. It's based on Google's open-source Chromium project, which is the core of Chrome. The Raspberry Pi version is the only version of the TRIGGERcmd agent that doesn't use a GUI and therefore doesn't use Electron - it just uses Node.JS.

      After the basic application and agents were ready, I wrote an integration with Alexa so you can use your voice to trigger commands. My best, most helpful user, @Christian-Robinson found TRIGGERcmd via the Alexa Skills store. He was actually looking for a way to run commands on his computer with Alexa.

      I wrote another integration with Zapier so you can trigger commands based on various events like a new gmail emails, new files in dropbox, new posts on slack or facebook, etc... Zapier also has scheduler, so you could trigger a command once per day or something. Zapier works like IFTTT. It has some advantages over IFTTT but it's not as well known. IFTTT also wants $2,388 per year to integrate, which is way too much for me at this point. Edit 5/28/17: Now you can use IFTTT to trigger commands via their free Maker service. Zapier won't publish the integration until I get at least 10 users, so you could help me out by trying TRIGGERcmd with Zapier.

      I also wrote an integration with SmartThings. Until Samsung approves it, you'll have to install it using their developer console. The TRIGGERcmd SmartApp lets you add virtual SmartThings switches for TRIGGERcmd commands you select. Then you can flip one of those virtual switches either manually in the SmartThings app, or automatically based on some event like motion sensed, a door opened, a temperature reached, switch flipped, etc... When you flip the virtual switch associated with your TRIGGERcmd trigger, it triggers the command, and immediately flips off.

      I added the ability to run commands remotely by running a command, then when while I was setting up my Raspberry Pi Zero W to run remote commands when I press buttons on an old VCR remote, I realized it's actually faster to just run a curl command that hits the REST API directly.

      Finally, I added Paypal integration so maybe someday TRIGGERcmd will make me some money, or maybe it will at least stop costing me money. You can use it without subscribing if don't want to run more than one command per minute. At this point the Alexa, Google Assistant, Zapier, and SmartThings integrations don't have that limitation. Nor does the command-line (or curl) method of triggering commands.

      I hope you like TRIGGERcmd as much as I do, and I hope you post your questions, bug reports, use cases etc. on the forum.

      posted in Blog
      Russ
    • RE: Installed background service, but background commands still not available

      I'm sorry installing the background service it didn't work. I hope I can figure out why. I have Windows 10 too. I just tried uninstalling and re-installing the background service and it works for me.

      Do you see the TRIGGERcmdAgent service listed in you Windows services? If so, maybe you just need to start it, or stop/start it.

      When you installed the background service, did you see a "User Account Control" prompt to allow Node.js to make changes to your device? I assume you click Yes to that?

      I'd appreciate any clues you can give me to help me reproduce the problem.

      posted in General Discussion
      Russ
    • RE: Installed background service, but background commands still not available

      Christian, I looked at your voice words for your commands, and tried them. The 2nd one worked well for me, but I had to remove the "ing" from the 1st one before Alexa recognized it.

      Your voice word for your computer worked well for me.

      One thing I found too is that Alexa understands better if you pause for about 1 second between "run X" and "on Y". So think of it like a comma - run this, on that.

      Also I just noticed a bug in the agent when I tested that. I found that if I only change the voice word for the command in commands.json, it doesn't update on the website. I had to change another field for it to update the command's voice word. Oops! I'll try to fix that and post a new version of the agent by tomorrow.

      Thank you for testing!

      posted in General Discussion
      Russ
    • RE: Installed background service, but background commands still not available

      Christian, I fixed it. Now when you install the background service while logged in as a non-admin, the service will use the home directory of your non-admin account. What was happening before (with 1.0.3) is it was using the home directory of the admin account who's credentials you typed in to install the service.

      posted in General Discussion
      Russ
    • RE: Installed background service, but background commands still not available

      Good question. Background commands run in the context of the windows service, so they run as the local system account by default. The background commands can't display things in the GUI, but because they run as the local system account they have full access to your PC, so they can do things like reboot or stop/start other services. Also, the windows service starts when you boot your PC, so you don't have to be logged in for the background commands to run.

      About documentation, you didn't miss it, I just haven't written much documentation yet. I need to work that. You're giving me ideas for what to document.

      posted in General Discussion
      Russ
    • RE: Prevent suppression of cmd window?

      @Christian-Robinson, I found that if you prefix your command with "start" your cmd window will show up in the foreground.

      {"trigger":"Test","command":"start C:\\test\\test.bat","ground":"foreground","voice":"test"},

      I notice it doesn't exit the window when the batch file completed though - I had to add "exit" to the end of the batch file to have it close.

      Contents of test.bat:
      echo hi
      pause
      exit

      posted in General Discussion
      Russ
    • RE: Feature request: Leave off computer name when issuing an Alexa command

      @Christian-Robinson, I added the default computer field in your Profile page. As soon as Amazon approves my update to the Alexa skill, you'll be able to use it like this:

      "Alexa, tell TRIGGERcmd run Calculator"
      or:
      "Alexa, open TRIGGERcmd"
      "run Calculator"

      It will run the command with voice word "calculator" on your default computer.

      Thanks again for the suggestion.

      posted in General Discussion
      Russ
    • RE: Feature request: Leave off computer name when issuing an Alexa command

      @Christian-Robinson Amazon approved my update to the skill, so now you can say, "Alexa, tell trigger c m d, Calculator."

      posted in General Discussion
      Russ
    • Running the Linux foreground agent without X-Windows

      The GUI Linux agent is built on Electron which is based on Chromium. Chromium is an open-source web browser project started by Google. It's a GUI app, so on Linux it exits if it doesn't find an X-Windows GUI.

      So if you want to run Linux without X-Windows, or if you want to run the agent in an SSH session, you can run it like this:

      node /usr/share/triggercmdagent/resources/app/src/agent.js --console

      Most people will probably only want to run background commands in the daemon. You can install the daemon with:
      /usr/share/triggercmdagent/resources/app/src/installdaemon.sh

      You can check the daemon status with:
      systemctl status triggercmdagent

      posted in Instructions
      Russ
    • Autohotkey script for Play, Pause, Volume Up/Down, Next/Previous

      You'll need to install this on your Windows box to make it work: https://autohotkey.com

      This is my media.ahk autohotkey script:

      Gosub, %1%
      return

      next:
      Send {Media_Next}
      return

      previous:
      Send {Media_Prev}
      return

      pause:
      Send {Media_Play_Pause}
      return

      play:
      Send {Media_Play_Pause}
      return

      stop:
      Send {Media_Stop}
      return

      volup:
      Send {Volume_Up}
      return

      voldown:
      Send {Volume_Down}
      return

      mute:
      Send {Volume_Mute}
      return

      These are the corresponding commands.json entries:

      {"trigger":"Mute","command":"start C:\\autohotkeyscripts\\media.ahk mute","ground":"foreground","voice":"mute"},
      {"trigger":"Volume Up","command":"start C:\\autohotkeyscripts\\media.ahk volup","ground":"foreground","voice":"volume up"},
      {"trigger":"Volume Down","command":"start C:\\autohotkeyscripts\\media.ahk voldown","ground":"foreground","voice":"volume down"},
      {"trigger":"Media Next","command":"start C:\\autohotkeyscripts\\media.ahk next","ground":"foreground","voice":"next"},
      {"trigger":"Media Stop","command":"start C:\\autohotkeyscripts\\media.ahk stop","ground":"foreground","voice":"stop"},
      {"trigger":"Media Previous","command":"start C:\\autohotkeyscripts\\media.ahk previous","ground":"foreground","voice":"previous"},
      {"trigger":"Media Play Pause","command":"start C:\\autohotkeyscripts\\media.ahk pause","ground":"foreground","voice":"pause"},

      NOTE: You don't need a Play and a Pause because they do the same thing - they just toggle between play and pause.

      This is optional, but I'm also using my Raspberry Pi based IR receiver to trigger the above commands with a VCR remote.

      I have these entries in my /etc/lirc/lircrc file on the Pi:

        begin
             prog = irexec
             button = KEY_1
             config = export HOME=/root ; /root/triggertest.sh play downstairs
        end
        begin
             prog = irexec
             button = KEY_2
             config = export HOME=/root ; /root/triggertest.sh notepad downstairs
        end
        begin
             prog = irexec
             button = KEY_PLAY
             config = export HOME=/root ; /root/triggertest.sh "Media Play Pause" downstairs
        end
        begin
             prog = irexec
             button = KEY_PAUSE
             config = export HOME=/root ; /root/triggertest.sh "Media Play Pause" downstairs
        end
        begin
             prog = irexec
             button = KEY_RIGHT
             config = export HOME=/root ; /root/triggertest.sh "Media Next" downstairs
        end
        begin
             prog = irexec
             button = KEY_LEFT
             config = export HOME=/root ; /root/triggertest.sh "Media Previous" downstairs
        end
        begin
             prog = irexec
             button = KEY_STOP
             config = export HOME=/root ; /root/triggertest.sh "Media Stop" downstairs
        end
        begin
             prog = irexec
             button = KEY_UP
             config = export HOME=/root ; /root/triggertest.sh "Volume Up" downstairs
        end
        begin
             prog = irexec
             button = KEY_DOWN
             config = export HOME=/root ; /root/triggertest.sh "Volume Down" downstairs
        end
        begin
             prog = irexec
             button = KEY_MUTE
             config = export HOME=/root ; /root/triggertest.sh "Mute" downstairs
        end
      posted in Windows
      Russ
    • RE: HTTP POST

      Good question @jgodney. For security, I chose not to allow variables passed as command-line parameters.

      I wanted to prevent a hacker who might somehow guess your password from being able to execute anything except the commands you've setup on your computers.

      For example, a bad guy could send an & or ; in the parameter field that would allow them to run any arbitrary command they wanted on your computer. Not good...

      I thought about scrubbing the parameters to remove any special characters, and only allow numbers and letters. That seems relatively safe, but then I could see people building scripts that take a parameter and execute it as a command.

      What's your opinion on this?
      Am I'm being too concerned about security at the expense of functionality?

      posted in General Discussion
      Russ
    • Google your parameters

      You can google your parameters with a batch file like this:

      start https://www.google.com/search?q=%1%%20%2%%20%3%%20%4%%20%5%%20%6%%20%7
      

      You need a double % because a batch file would interpret %20 as your second parameter plus 0. The double % tells it you want %20 which is the URL code for a space.

      posted in Windows
      Russ
    • RE: Google Home: Can I mute the answer?

      @jakob, not yet, but it's a good idea.

      Someone else actually suggested I let people choose what Alexa/Google Assistant will say. So in your case, you could put a space in that field so it says nothing. I figured I'd make it say what it says now if you leave the field blank.

      posted in General Discussion
      Russ
    • RE: Google Home: Can I mute the answer?

      @christopher-hedberg, ok, I'll work on it soon. I have a bug in the Mac agent that I need to fix first.

      posted in General Discussion
      Russ
    • RE: Mac app issues

      @dewi-morgan, these problems are fixed now in the latest version. Let me know if find out they're not fixed.

      posted in General Discussion
      Russ
    • RE: Usage story (is there a direct GET API for triggering?)

      @dewi-morgan, I see the issue.

      Some of our commands are set as "background" commands. The mac client will ignore those entries. If you change them to foreground, they should work fine.

      I didn't implement the background service on the mac client.

      posted in General Discussion
      Russ
    • RE: New Bookmark option for each trigger

      @tim-s, that's right - you could even just change the trigger name and change it back, and it would invalidate the bookmark URL.

      posted in Announcements
      Russ
    • RE: How to Trigger with single sentence?

      @nabeel, there are a few ways to avoid saying TRIGGER CMD:

      • Use the "TRIGGER Command" skill instead of the TRIGGERcmd skill.
      • Use a Google Assistant shortcut like my "open sesame" example for opening my garage.
      • Use SmartThings with an Alexa "routine"
      • Use SmartThings and say, "turn on X" (where X is your virtual switch for your command).
      • Use IFTTT like you said.

      My favorite method is a Google Assistant shortcut.

      posted in General Discussion
      Russ