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

    Any idea why this batch is failing to run?

    Windows
    2
    2
    137
    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.
    • StrahanS
      Strahan
      last edited by

      Hi. Ever since IFTTT and Alexa stopped working, I started making a bunch of TriggerCMD triggers to fill in the void. I made a website to log health data (calories eaten, exercise done, etc). So I made a batch file:

      @echo off
      echo %1 %2 %3 %4 %5 >>log.txt
      if "%1"=="med" goto :medication
      if "%1"=="bedtime" goto :bed
      c:\misc\wget.exe "https://mysite.com/index.php?m=api&sm=food&food=%1"
      goto :eof
      
      :medication
      if "%2"=="fi8" c:\misc\wget.exe "https://mysite.com/index.php?m=api&sm=insulin&type=fast&amt=8"&goto :eof
      if "%2"=="fi10" c:\misc\wget.exe "https://mysite.com/index.php?m=api&sm=insulin&type=fast&amt=10"&goto :eof
      if "%2"=="fi12" c:\misc\wget.exe "https://mysite.com/index.php?m=api&sm=insulin&type=fast&amt=12"&goto :eof
      if "%2"=="fi14" c:\misc\wget.exe "https://mysite.com/index.php?m=api&sm=insulin&type=fast&amt=14"&goto :eof
      if "%2"=="fi18" c:\misc\wget.exe "https://mysite.com/index.php?m=api&sm=insulin&type=fast&amt=18"&goto :eof
      if "%2"=="li50" c:\misc\wget.exe "https://mysite.com/index.php?m=api&sm=insulin&type=long&amt=50"&goto :eof
      if "%2"=="night" c:\misc\wget.exe "https://mysite.com/index.php?m=api&sm=nightmeds"&goto :eof
      
      c:\misc\wget.exe "https://mysite.com/index.php?m=api&sm=meds&mid=%2&units=%3"
      goto :eof
      
      :bed
      echo %2 >>log.txt
      

      I have a bunch of commands. Here is a sample:

      Trigger: diet pepsi
      Command: c:\misc\loghealth.bat dpepsi12
      Off command: (greyed out)
      Ground: foreground
      Voice: diet pepsi
      Voice reply: (empty)
      Allow parameters: false
      

      This works great. I say "Alexa, turn on diet pepsi" then check my health site and it has logged a can of Diet Pepsi. I also track my bedtime/getting up times so if I feel drug out I can look at my health site and be like well yea, I slept 5 hours 12 minutes no doubt heh. I wanted to leverage the on/off ability, figuring I'd say "Alexa turn on bedtime" to mark myself asleep and turn off to mark awake:

      Trigger: bedtime
      Command: c:\misc\loghealth.bat bedtime on
      Off command: c:\misc\loghealth.bat bedtime off
      Ground: foreground
      Voice: bedtime
      Voice reply: (empty)
      Allow parameters: true
      

      However, neither on nor off works. I added the echo to log.txt lines and I never even get a log.txt, so it's not firing the batch at all.

      Any idea why? Thanks!

      RussR 1 Reply Last reply Reply Quote 0
      • RussR
        Russ @Strahan
        last edited by Russ

        @Strahan, that should work.

        Do you see an Alexa device called "bedtime" in the Alexa app?
        667c86ef-d339-433a-acd2-c9d521cb6e3c-image.png

        FYI, you could also remove the on and off portion of the command, and clear the "Off command" field like this because the agent will add " on" or " off" to your command depending on whether you're flipping the virtual switch on or off.

        Trigger: bedtime
        Command: c:\misc\loghealth.bat bedtime
        

        At first I was concerned that bedtime might be a reserved word, but I tried "bedtime" and "bed time" in the Voice field and both worked for me.

        82dfaf50-a9a4-4549-9f78-e8001a91b436-image.png

        Russell VanderMey

        1 Reply Last reply Reply Quote 0
        • First post
          Last post