Passing multi-word parameters.
-
Hello i am using TriggerCMD to run a script that plays media from my server, the parameter only passes the first word of my proposed parameters.
example: (I used Alexa to test because i cant figure out how to pass parameters with google anymore, since it is just on/off now)
- Launch TC
- run Play Media from server with Parameter The Office
It runs and executes but the parameter is only "the"
Is this an oversight by me or are multiword parameters not supported?Also, with the google assistant stuff, is there a way to pass the parameters now that they have disabled the conversational stuff?
Thank you for your help and all you do! this is a sweet tool and I'm having a blast automating with it!
-
@Trey-Chance, when you're testing your script with parameters, I recommend using the Parameters button for that command before using the Alexa skill.
You're correct that you can no longer run commands with arbitrary parameters via Google Assistant because they disabled conversational actions. The TRIGGERcmd Smart Home Google Assistant action can pass a single parameter like on, off, a number from 1 to 100, or a color like green, blue, red, etc.
I just used this script to test sending multiple parameters via the Parameters button, then the TRIGGERcmd Alexa skill and it worked for me.
echo "%1 %2 %3 %4 %5 %6 %7 %8 %9" >> d:\tools\Logger.log
I said, Alexa, ask TC to run logger with parameter russ russ russ and this is what I got in d:\tools\Logger.log:
"Russ Russ rusk "
I wonder if you're using a batch file that only uses %1? If so, that's only going to capture the 1st parameter. %2, %3, etc will capture your 2nd and 3rd parameters.
-
@Russ Thank you for the response! I'm using PowerShell currently and figured out a workaround based on your response. for anyone that could be useful for it was pretty easy to concatenate them and create a final input for my script to search my server. In this example i went a little overboard with 12 words total. It's currently working great with the parameter passthrough via TriggerCMD, but I have not tested it on Alexa yet.
param ([string]$media1,$media2,$media3,$media4,$media5,$media6,$media7,$media8,$media9,$media10,$media11,$media12) $mediafinal=("$media1 $media2 $media3 $media4 $media5 $media6 $media7 $media8 $media9 $media10 $media11 $media12").trim()
Basically I am creating a script that allows me to ask Alexa to play anything from my Emby server and it will play to my default device (Livingroom Shield). In the future I would like to differentiate the params to allow me to say "Play Media from Server with parameters <Show> on <Insert device>"
When using Alexa skill TC is there a known way to do this all in one command? currently I have to say Launch TC or talk to TC first then I can input my command for TriggerCMD.
I will post my script here once I finish for anyone interested!
-
@Trey-Chance, this is the basic speech formula to use the TC conversational Alexa skill:
Alexa, ask TC to run notepad with parameter X.
So in your case it would be something like this:
Alexa, ask TC to run Play Media with parameter Seinfeld on Shield.
BUT, I want to caution you that the conversational skills don't match your words to your commands as well as the Smart Home skill, so if you can somehow do what you want using the TRIGGERcmd Smart Home skill, I recommend it.
The Smart Home skill can pass on or off but it can also pass number from 1 to 100, so in your case you could create a command with voice word "Livingroom," and enable parameters, then say, "Alexa, Livingroom 10" or "Alexa, Livingroom 20" and script would use a numbered list of media to play the right media on your Livingroom shield device.