IMPORTANT NOTE on above
you must make the sendresult.sh bash script executable. go to terminal and:
cd ~/.TRIGGERcmdData/
chmod +x sendresult.sh
IMPORTANT NOTE on above
you must make the sendresult.sh bash script executable. go to terminal and:
cd ~/.TRIGGERcmdData/
chmod +x sendresult.sh
@Russ Hi. Thank you for attempting this. Sorry I had no email notifications turned on, so didn't get this until today.
Just tried it, there seem to be gatekeeper issues.
normally I can bypass this with a terminal command called xattr. However in this case even that doesn't work.
usually this has to do with lack of code signing the executable.
i reinstalled the x64 version and got this, which is expected, and after confirming it launched. note that I did not need to use xattr on this one, but maybe I had previously?
(Prior to this, today, while adding some new actions, it crashed more than once.)
I wanted Alexa to be able to report what is playing in (Apple) Music. I came up with these, which I am delighted to say, work:
WHAT ARTIST
osascript -e 'tell application "music" to set result to artist of current track' | sed 's/^/"/;s/$/"/' | xargs -I{} ~/.TRIGGERcmdData/sendresult.sh {}
Voice: what artist
Voice Reply: This artist is {{result}}
WHAT SONG
osascript -e 'tell application "Music" to set result to "This song is " & name of current track & " by " & artist of current track & " on the " & year of current track & " album " & album of current track' | sed 's/^/"/;s/$/"/' | xargs -I{} ~/.TRIGGERcmdData/sendresult.sh {}
Voice: what song
voice reply: {{result}}
Note: I'm not a terminal wiz, I'm not sure if this is the most efficient way to do this (happy for suggestions), but it works. the "sed" part is just to quote the result from "Music"
Of course you have to enable the Trigger Command Alexa skill. So you'd say:
"Alexa, ask Trigger Command to run What Song" or "…What Album"
BONUS: NEXT ALBUM
and now that I was on a roll, I tried something more complicated that needs to run an applescript file, playing a new album in the current playlist:
osascript ~/Library/Scripts/Applications/Music/commands/next.album.scpt | sed 's/^/"/;s/$/"/' | xargs -I{} ~/.TRIGGERcmdData/sendresult.sh {}
voice: Next Album
voice reply: {{result}}
applescript:
tell application "Music"
set rcount to 0
set talb to album of current track
repeat
set rcount to rcount + 1
next track
set newalbum to album of current track
set newartist to artist of current track
if newalbum is not talb or rcount > 30 then exit repeat
end repeat
set result to "Playing " & newalbum & " by " & newartist
end tell
(saved as "next.album.scpt" and saved to path as given above. of course you can rename and/or change the path. the count is just a fail safe if album has too many tracks, can change of course)
@Russ thanks. i did not delete it. i came in hot as a newbie, made minimal changes. some error there, or maybe had to do with the crash.
also purely on a side note, I made the voice command "mac music" and it worked, to my surprise. Both Siri and Alexa are very aggressive in interpretting anything having to do with music (tunes, jukebox, songs, etc.) as an intent to play random shit from their poor cloud services.
@Russ Hi. Thanks! Got it to work and yep that was it: I hadn't set a default computer. If the need to explicitly set a default computer was mentioned somewhere obvious in the installation instructions, I missed it. I would suggest the first computer added is automatically made the default computer until it's changed.
edit: I see in the link you provided above that "The first computer in your account is your default computer by default". However mine was not.
@Russ thanks. pls check into translocation too.
Here's a crash log from just now.
@Russ Thanks you.
It is linked. No devices show up in the Alexa device list for any of the two commands that have a voice word. (Calculator, Elephant).
New user here. I have installed the Mac agent (see separate thread on related problems). Account created, token accepted, etc. Alexa TriggerCMD SmartHome skill enabled and linked to account.
I am at a loss on how to trigger any command with alexa. The default "Alexa, turn on calculator" > alexa: "welcome to calculator" (etc) -- activates an internal skill.
I created a new command with "music" in the voice field, and an osascript to play music in the command field:
osascript -e 'tell application "music" to play'
I say, "Alexa turn on music" > it plays something on Amazon music.
I changed the voice field to "elephant", and say "Alexa turn on elephant" > Alexa makes a "success" chime but does nothing.
I say "Alexa elephant" > alexa makes an elephant sound with a "zoo keeper" skill
Is there a log to view here?*
What else to try?
what if I don't want to use the "turn on" syntax, but instead, say "alexa play mac music?" ?
EDIT: *found the way to "view runs" on "view triggers". I was able to run commands from the web interface as expected. (by the way, first time i had to grant permissions for TCMD to control apps; privacy&security>automations). alexa skill, however, still does nothing.
Hi. Just trying this for first time.
The agent, installed in /Applications/ launches but has now crashed twice when editing commands.
Also it appears to be running in translocation mode. According to LittleSnitch:
"The application is running in App Translocation, a macOS security mechanism for apps that are not properly installed. You cannot create permanent rules until you move the application to the Applications folder and launch it from there."
It is actually running from:
/private/var/folders/*/TRIGGERcmdAgent.app/Contents/MacOS/TRIGGERcmdAgent
Also:
• any chance of an ARM build?
• how bout option to make the menu bar icon a more standard black & white, with a dark mode?