Commands that use Nircmd.exe (toggle mute, say stuff, etc.)
-
SimKeys.ahk
; By SKAN, http://goo.gl/JfMNpN, CD:23/Aug/2014 | MD:24/Aug/2014 #Warn #SingleInstance, Force Args( CmdLine := "", Skip := 0 ) { Local pArgs := 0, nArgs := 0, A := [] pArgs := DllCall( "Shell32\CommandLineToArgvW", "WStr",CmdLine, "PtrP",nArgs, "Ptr" ) Loop % ( nArgs ) If ( A_Index > Skip ) A[ A_Index - Skip ] := StrGet( NumGet( ( A_Index - 1 ) * A_PtrSize + pArgs ), "UTF-16" ) Return A, A[0] := nArgs - Skip, DllCall( "LocalFree", "Ptr", pArgs) } CmdLine := DllCall( "GetCommandLine", "Str" ) Skip := ( A_IsCompiled ? 1 : 2 ) argv := Args( CmdLine, Skip ) If ( argv[0] == 1 ) Send % argv[1] Else Msgbox, , Error, Must provide exactly one argument, 10 ;Msgbox % "Count = " argv[0] "`n1=" argv[1] "`n2=" argv[2] "`n3=" argv[3] "`n4=" argv[4] "`n5=" argv[5]
SimKeys.vbs
Dim WshShell Set WshShell = WScript.CreateObject("WScript.Shell") WshShell.SendKeys WScript.Arguments(0)
Excerpt from commands.json
{"trigger":"Play", "command":"\"C:\\Program Files\\AutoHotkey\\AutoHotkeyU64\" C: YOUR DIRECTORY \\SimKeys.ahk {Media_Play_Pause}", "ground":"foreground", "voice":"play"}, {"trigger":"Pause", "command":"\"C:\\Program Files\\AutoHotkey\\AutoHotkeyU64\" C: YOUR DIRECTORY \\SimKeys.ahk {Media_Play_Pause}", "ground":"foreground", "voice":"pause"}, {"trigger":"Stop", "command":"\"C:\\Program Files\\AutoHotkey\\AutoHotkeyU64\" C: YOUR DIRECTORY \\SimKeys.ahk {Media_Stop}", "ground":"foreground", "voice":"stop"}, {"trigger":"Previous", "command":"\"C:\\Program Files\\AutoHotkey\\AutoHotkeyU64\" C: YOUR DIRECTORY \\SimKeys.ahk {Media_Prev}", "ground":"foreground", "voice":"previous"}, {"trigger":"Next", "command":"\"C:\\Program Files\\AutoHotkey\\AutoHotkeyU64\" C: YOUR DIRECTORY \\SimKeys.ahk {Media_Next}", "ground":"foreground", "voice":"next"}, {"trigger":"Volume Up", "command":"\"C:\\Program Files\\AutoHotkey\\AutoHotkeyU64\" C: YOUR DIRECTORY \\SimKeys.ahk {Volume_Up}", "ground":"foreground", "voice":"volume up"}, {"trigger":"Volume Down", "command":"\"C:\\Program Files\\AutoHotkey\\AutoHotkeyU64\" C: YOUR DIRECTORY \\SimKeys.ahk {Volume_Down}", "ground":"foreground", "voice":"volume down"}, {"trigger":"Mute/Unmute", "command":"\"C:\\Program Files\\AutoHotkey\\AutoHotkeyU64\" C: YOUR DIRECTORY \\SimKeys.ahk {Volume_Mute}", "ground":"foreground", "voice":"mute"},
Replace "YOUR DIRECTORY" with the proper path to SimKeys.ahk and SimKeys.vbs (both need to be in the same location).
Edit: It appears SimKeys.vbs is not necessary. I don't remember why I have it--possibly because I was trying out an alternate method and forgot to move/remove it. I'm leaving it here just in case.
-
@Christian-Robinson Thanks! I am novice but I am going to use this accomplish my goals; (to copy my other post) I would like to disable or override Alexas voice and only hear what I want it to say. For example, when my Smarthings sensor on my front door is triggered, my computer will say "front door is open". I have a whole house audio system that I control with my computer. Monoprice Zone amp. I also have software someone built that I can control the 12 zones... My goal here is to have things happen in the house and the house starts talking back (via my computer) I had this all set up years ago with x10 ... but now I am going all to z wave and smarthings. Any ideas if you think I am on the right track with Triggercmd and Autohotkey??
-
You can't override Alexa's responses, unfortunately. The "voice" part of the configuration for TRIGGERcmd is for what you say to Alexa.
-
could I use Triggercmd to make my computer talk, like when the front door opens? I can just turn her down.
-
...My computer is my main sound in my house. I run spotify on it... I have alexa on the "Line in" with "Listen" enabled, so I can hear her and whatever is running on my windows 10
-
Theoretically, yes, as long as you're willing to go with "canned" messages. Windows 10 (and 8, I'm assuming) has some support for text-to-speech, but it's not very accessible. Somewhere I came across a small vbs that can do short messages on the command line:
say.vbs
set s = CreateObject("SAPI.SpVoice") s.Speak Wscript.Arguments(0), 3 s.WaitUntilDone(1000)
It's called this way:
cscript say.vbs "hello world"
-
I just use a passive stereo mixer to allow me to hear my Echo Dot, my TV, my computer, etc. at once. Same concept, basically.
-
@Christian-Robinson
I am new to this Triggercmd and am going to research the best way to "Listen" for my Zwave events coming through Smartthings and using Triggercmd to activate the canned messages like "Front door is open" or "Garage has been compromised" or "Welcome home Nate you look amazing today"... I could listen to that every-time i walked in. haha. Any ideas you have I would be happy to hear. -
@Nate-Hales You're going beyond what I'm doing with Alexa/TRIGGERcmd/home automation, so I don't know if I could help you much. I hope the tools I posted above can be useful, though.
-
@Christian-Robinson Yes Thank you!! Saves a ton of time as I am all about making my house do whatever is possible.
-
@Nate-Hales you said "I have alexa on the "Line in" with "Listen" enabled, so I can hear her and whatever is running on my windows 10"
I tried this with alexa and got some odd noises when she was listening so i had to unplug her. Did you have that problem and find a fix or just didnt have it? im in the same setup.. htpc does all the sound.