Trigger SoundFlow command from Apple Automator with Variable?
What's up everyone!
I was looking for a way to start integrating Automator Applications in order to make one-off tasks a bit more accesible than they currently are -- being several pages deep on my StreamDeck. I see here (https://help.soundflow.org/en/articles/5638030-soundflow-cli) you can trigger SoundFlow commands from the command line however it doesn't note if it's possible to send a variable through to said SoundFlow command. I also don't seem to have the /usr/local/bin/soundflow
and am not sure how to install it as it didn't appear after re-installing SoundFlow.
Any help would be great!
Thanks!
Nathan

- In reply tonathansalefski⬆:Dustin Harris @Dustin_Harris
Check this post out, you can use Automator to run the desired command in terminal.
Nathan Salefski @nathansalefski
Amazing. I'll give it a shot. Any clue why I'd be missing the
/usr/local/bin/soundflow
though? I've tried reinstalling but perhaps I need to try a clean installDustin Harris @Dustin_Harris
Not sure… I haven’t done the SoundFlow install location deep dive… what do you need it for?
Nathan Salefski @nathansalefski
Without that specific pathway defined in Automator, Automator cannot run the SoundFlow command via the CLI
Dustin Harris @Dustin_Harris
You should be able to use Automator to run a shell script or AppleScript, each of which can contain terminal commands to run the soundflow script, and is probably the preferred method anyway.
My implementation is a little different here as I’m running applescript from inside SoundFlow, but might be handy for reference:
- In reply tonathansalefski⬆:Kitch Membery @Kitch2024-04-24 17:18:29.193Z
Hi @nathansalefski,
What specifically are you trying to achieve with Automator?
Nathan Salefski @nathansalefski
It’s fairly simple. You can make “Apps” with the Automator. I’d like to have an app on my dock that I can drag folders onto and the app passes that array along to my existing session prep script
Kitch Membery @Kitch2024-04-24 17:39:43.355Z
What information about the folders are you wanting to be passed along?
The file paths inside the folder?
Nathan Salefski @nathansalefski
The folder pathways themselves. SoundFlow is searching those folders for WAVs and MP3s then creating a session from my template and importing the files from each of the selected folders
Kitch Membery @Kitch2024-04-24 17:59:54.182Z
An approach you could use for this without the need for Automator, could be done as follows.
Select a folder in the finder and run the following script.
// Get all files recursively from the selected directory in the finder. const folderFilePaths = sf.file.directoryGetFiles({ path: sf.ui.finder.firstSelectedPath, isRecursive: true, }).paths // Filter .wav files const wavFilePaths = folderFilePaths.filter(path => path.endsWith(".wav")); log(wavFilePaths);
Nathan Salefski @nathansalefski
Yea i've got it working fine opening finder and then calling the command I just wanted to save menu diving for the button and just drag the folders onto the icon instead. Seems more trouble than it's worth though but thanks!
Kitch Membery @Kitch2024-04-24 18:58:06.047Z
No worries. And yes I see what you mean.
Be sure to request this functionality in the ideas section of the forum, so it can be considered for future SoundFlow updates.
Nathan Salefski @nathansalefski
@Dustin_Harris helped me with the how. The issue I'm running into is the Automator isn't detecting the SoundFlow CLI. In the picture in the original post you can see you can choose pathways for the ShellScript to reference but the
/usr/local/bin/soundflow
that's neccesary (as stated here https://help.soundflow.org/en/articles/5638030-soundflow-cli) isn't an option for me to choose. Running a simple script from terminal works fine though which means it exists on my computer, just seems like Automator cannot reference it. Very stange issue on my end or with Automator itself. I'll be sure to post it as an ideaDustin Harris @Dustin_Harris
in automator you can add the action 'run shell script' and then trigger the soundflow CLI from there I believe..
Chris Shaw @Chris_Shaw2024-04-25 01:20:13.494Z2024-04-25 03:40:45.449Z
You don't need automator to get the folder paths either. When you drag folders onto a app in the dock the folders remain selected in the Finder so you can grab their paths within the SF script itself.
The only thing automator needs to do is run the SF command via a simple shell / terminal scriptKitch Membery @Kitch2024-04-25 01:22:06.028Z
Brilliant!!
- In reply tonathansalefski⬆:
Kitch Membery @Kitch2024-04-25 01:57:00.596Z
Did you try the full path...
/usr/local/bin/soundflow soundflow run user: <COMMAND ID HERE>
Nathan Salefski @nathansalefski
Yes when I do so a cog wheel appears briefly in the menu bar and nothing happens. Using just
soundflow run user: <COMMAND ID HERE>
results in this error:Kitch Membery @Kitch2024-04-25 03:11:42.343Z
Try these steps.
- Create a Script in SoundFlow
const {arg1, arg2} = event.arguments; log(arg1) log(arg2)
- Use the following command line in your Automator app and replace the command ID with the SoundFlow Scripts ID.
/usr/local/bin/soundflow run user:xxxxxxxxxxxxxxxxxxxxxxxx:xxxxxxxxxxxxxxxxxxxxxxxx '{ "arg1": "Arg 1 from Automator","arg2": "Arg 2 from Automator", }'
- Double-click the app or drag a file onto it.
What happens?
The argument values should be logged.
Let me know if that works for you.Nathan Salefski @nathansalefski
Finally! I'm not exactly sure what issue I was running into but that seemed to work. I know that Chris mentioned not needing to pass arguments becuase the folders would be highlighted in Finder but what if I drag them from another app, Like Samply for example? I think it would be great to be able to pass the input on through to SoundFlow rather than relying on Finder being in the foreground. I don't know how to do that though lol