Use Alexa or Google Nest to control your computer with AHK

Helpful script writing tricks and HowTo's
User avatar
tadamm
Posts: 41
Joined: 27 Sep 2020, 11:41

Use Alexa or Google Nest to control your computer with AHK

19 Mar 2021, 14:51

I found this cool skill called trigger cmd which then lets me run a AHK script to do pretty much anything i want on my computer.

1.You just download the exe to computer and the skill on the Alexa app.

2.Set up what you want to say to your Alexa to run a script

3. Code AHK to do what ever you want.



Download = https://www.triggercmd.com/en/


How To = https://www.youtube.com/watch?v=D6kXPRd8ZGQ
that1ahkpro
Posts: 3
Joined: 16 Apr 2021, 09:20

Re: Use Alexa or Google Nest to control your computer with AHK

16 Apr 2021, 09:31

Bro cool asf thank you so muchhh

the software is paid tho. is there a free alternative?
BoBo
Posts: 6563
Joined: 13 May 2014, 17:15

Re: Use Alexa or Google Nest to control your computer with AHK

02 Aug 2022, 11:33

A little script snippet that acts as an interface for sending stuff (to be exactly the parameters of a :arrow: triggerCMD command (line)) to your PC for further processing.

The default delay after a "keypress" is 1 second. To set another delay use this parameter format <string>:<number> ie "AHK Rocks:1.2" where <number> is representing the delay in seconds. If your string is of this format c(<digit>) ie c(65) the script will convert this string into its ASCII-character equivalent.

So a space separated triggerCMD command could look like this:

autohotkey.exe sendKey.ahk {F2}:1.5 {F3}:5 {F3}:5 {F4} (will press/send the keys F2/F3/F3/F4 with its specified delays)

autohotkey.exe sendKey.ahk trigger:0 c(67):0 M:0 c(68):0 (will send the string 'triggerCMD' with the least possible delay)


sendKey.ahk

Code: Select all

#SingleInstance, Force
SetBatchLines, -1

Loop % A_Args.Count()												;loop for the number of parameters
   {  param := StrSplit(A_Args[A_Index],":")						;check if parameter contains a colon ('delay-flag'), if yes create an array
      p := InStr(A_Args[A_Index],":")  ? param.1 : A_Args[A_Index]	;get the 1st/string element of the array
      p := InStr(p,"c(")               ? Chr(SubStr(p,3,-1)) : p	;..but if that string is matching the ASCII-conversion format, convert it
      d := InStr(A_Args[A_Index],":")  ? param.2 : 1				;get the 2nd/delay element of the array
      Send  % p														;send the string/a keypress
      Sleep % d*1000												;wait for the specified time
   }

Return to “Tutorials (v1)”

Who is online

Users browsing this forum: No registered users and 41 guests