How to Pass Variables and Execute the Shell Script

Hi, All~

I want to create a macro using ffmpeg to convert videos to mp3 audio files.

I built my macro upon the post Run Single Command on Finder Selection - Macro Library - Keyboard Maestro Discourse

Below is the screenshot of the macro


When I ran the macro, the notification said:


32%20PM


So I tried to run the command directly in iTerm2, and it worked. See screenshots below.


When I ran ``which ffmpeg`` it showed as ``/usr/local/bin/ffmpeg``

I wonder what I did wrong. Any feedback or suggestions would be greatly appreciated. Thanks! :two_hearts:

Ah....
Never mind! I think I figured it out.

I find this post: Can I commit files from Git from KM? - Questions & Suggestions - Keyboard Maestro Discourse

So I added
export PATH=/usr/local/bin:$PATH;
at the beginning of the script, and it now works!

2 Likes

In the Execute Shell Script action that failed, if you select Help from the gear menu, you will be taken to the Execute a Shell Script action documentation. In the Path in Shell Scripts section is the details of the solution.