Have Alexa say result of long running process, like chkdsk
-
This is probably not something for a beginner, but it uses lot of TRIGGERcmd functionality, so it's a good learning experience.
I made this video to explain the process.
Prerequisites:
- Link the TRIGGERcmd Smart Home Alexa skill
- Link the TRIGGERcmd Alexa skill
- Install the tcmd command line tool.
This is how it works:
- I say, "Alexa, turn on check disk"
- TRIGGERcmd Smart Home Alexa skill runs the TRIGGERcmd command called chkdsk_run.
- d:\tools\run_chkdsk.bat script runs, including chkdsk > d:\tools\log.chk, then tcmd -c russhp -t chkdsk_routine.
- My chkdsk report Alexa routine runs with custom action: ask TRIGGER C M D to run report
- TRIGGERcmd Alexa skill runs the TRIGGERcmd command called chkdsk_report.
- d:\tools\report_chkdsk_status.bat script runs, including %USERPROFILE%\.TRIGGERcmdData\SendResult.bat good (assuming the chkdsk log shows "No further action is required.")
- TRIGGERcmd Alexa skill audibly replies, "Check disk good"
My three TRIGGERcmd commands:
My d:\tools\run_chkdsk.bat file:
del d:\tools\log.chk chkdsk c: > d:\tools\log.chk tcmd -c russhp -t chkdsk_routine
My report_chkdsk_status.bat file:
type d:\tools\log.chk | find "No further action is required." IF ERRORLEVEL 1 goto bad goto good :good %USERPROFILE%\.TRIGGERcmdData\SendResult.bat good goto end :bad %USERPROFILE%\.TRIGGERcmdData\SendResult.bat bad :end
My Alexa routine:
Notice the chkdsk_run command is a background command, so make sure you install the background service first, like this:
The run_chkdsk.bat needs to run in the background service so it runs as Local System. That gives it access to run chkdsk.exe.
The run_chkdsk.bat script also includes this command: tcmd -c russhp -t chkdsk_routine
The tcmd command needs your token.tkn file to authenticate with your TRIGGERcmd account.
The tcmd command will look for token.tkn in the user's .TRIGGERcmdData folder within the user's profile folder. The TRIGGERcmdAgent background service runs as Local System, and Local System user's profile folder is C:\Windows\System32\config\systemprofile. You'll need to run a cmd window "as administrator" to access that folder, like this:
Run these commands in that cmd window to copy your token.tkn file to the Local System user's .TRIGGERcmdData folder:
cd C:\Windows\System32\config\systemprofile\ mkdir .TRIGGERcmdData cd .TRIGGERcmdData copy %USERPROFILE%\.TRIGGERcmdData\token.tkn .
-
-
-
-