I don't know if this is the right place for this post and if not, please relocate where it needs to be.
My wife is visually impaired can I use TriggerCMD to set up voice commands for her. We have a combination of Alexa enable light switches and x10 light switches. So I set up the TriggerCMD combined with and autohotkey script to control the x10 light switches. My home automation system consist of several PCs, one of which is a central server and the TriggerCMD default computer where the commands for the X10 light switches are located. There are two more PCs that are used as HTPCs running Windows 7 Media Center.
On my wife's HTPC she can either tune and local broadcast stations or youtubeTV cable stations using a remote control. She can also access other streaming services by entering a channel number that I have assigned to that streaming service. This all goes into an autohotkey script that calls up the appropriate streaming service and runs a URL for that channel. For example, I have assigned channel 2004 to run the Dog the Bounty Hunter on Pluto. When she enters the 2004 on her remote the script will run the appropriate URL and go through all the steps required to get it to full screen with the sound unmuted.
And all of that works great except she has a hard time remembering what channel does what. So for her favorite channels I have set up a TriggerCMD for each so that she can say for example, "Alexa run Dog The Bounty Hunter."
I started out with the TriggerCMD on her PC. However, she needed to say, "Alexa run Dog the Bounty Hunter on Samsung". I used the voice Samsung as her PC name because the actual name was BSB-DVR and TriggerCMD would hear other letters or words for the letters spoke. So using a full word instead of a series of letters seems to be the best way to set up your computer voice name. She found it confusing to have to say, "Alexa run Dog the Bounty Hunter on Samsung" and why not just "run Dog the Bounty Hunter."
So to do that I needed a method of putting the voice commands central server with all of the X10 light switch commands and having the central server tell the remote HTPCs what channel to run.
Autohotkey to the rescue. What I did was to have the autohotkey script on the server write the channel number to a configuration (.ini) file on the server. Autohotkey has some Nifty built-in functions for IniWrite and IniRead. Then on the HTPCs the autohotkey script for the television operation will read the configuration file on the server once per second looking for the channel number trigger to be other than zero. If a number is detected then the script will call up the appropriate channel number and write a zero to the server configuration file to clear the trigger.
Here is the server command:
{
"trigger": "Dog the Bounty Hunter",
"command": "C:\AHK\alexacommands.ahk 2004",
"OffCommand": "",
"ground": "foreground",
"voice": "Dog the Bounty Hunter",
"voiceReply": "OK",
"allowParams": "true"
}
Here is the \server\WMC\0-Triggers.ini server configuration file:
[Commands]
Lenovo-PC=0
BSB-DVR=0
RAB-DVR=0
server=0
Here is the alexacommands.ahk autohotkey script on the server:
#SingleInstance Force
Arg1 = %1%
Arg2 = %2%
;MsgBox %Arg1%***%Arg2% ;for debugging
if (Arg1 = 2004){
MsgBox,,, Run Dog The Bounty Hunter, 2
IniWrite, 2004, \server\WMC\0-Triggers.ini, Commands, BSB-DVR
;the HTPC network name (BSB-DVR) is hard coded for the HTPC this command
;is intended to control.
}
if (Arg1 = 202){
MsgBox,,, Run CNN, 2
IniWrite, 202, \server\WMC\0-Triggers.ini, Commands, BSB-DVR
}
Here is the part of the code that checks for the trigger on the HTPCs:
#SingleInstance Force
PCName$ = % A_computername
SetTimer, WinCheck, 1000
;Contents indicates which hotstring to jump to on startup
IniRead, StartPage, C:\WMC\YTconfig.ini, Config, StartPage
if (StartPage <> "none")
{
IniWrite, none, C:\WMC\YTconfig.ini, Config, StartPage ;reset StartPage
gosub %StartPage%
;StartPage contents has the number of the channel where to start.
}
/* The body of the HTPC script */
;timer function to check for new trigger:
WinCheck:
Trigger$ = 0
IniRead, Trigger$, \server\WMC\0-Triggers.ini, Commands, %PCName$%
if (Trigger$ <> 0){
MsgBox,,, %Trigger$%, 2
;reset StartPage:
IniWrite, %Trigger$%, C:\WMC\YTconfig.ini, Config, StartPage
;Clear Trigger
IniWrite, 0, \server\WMC\0-Triggers.ini, Commands, %PCName$%
run, \server\WMC\HTPC.ahk
}
return