I'm learning Chinese and want a way to quickly generate and save words and phrases to m4a files.

I've managed to do pretty much what I want in terminal, but I can't seem to figure out how to make an app out of it. Here is the code I've used in terminal:

cd ~/Desktop/test
say -o "whateveriwantittosay.m4a" "whateveriwantittosay"

How do I make an shell or Apple script that when opened prompts me for whateveriwantittosay, then creates the file? And maybe even asks me again for a new file.


  • If you add a function like cnsay() { for a; do say "$a" -o ~/"Desktop/$a.m4a"; done; } to ~/.bash_profile, you could run it with something like cnsay word1 word2.
    – Lri
    May 11, 2013 at 15:28

2 Answers 2


Simple Automator Application :

  • Create a new Application
  • Add a Ask for text action
  • Add a Run a sheel script action
  • Select Pass input as Arguments
  • Copy the following script (Assuming ~/Desktop/Test exists)


cd ~/Desktop/Test
say -o "$@.m4a" $@
  • Save your application. It's ready to use.

i would use python for this... since it is included in the vanilla OSX distibution.

Check wxPython together with pyApp assuming you mean a gui-based app..

Using python you can use subprocess in order to call any terminal command from python eg:

import subprocess
  • As written this does not really answer the question. Can you provide a sample python script which accomplishes what the asker is looking for in the question?
    – nohillside
    May 11, 2013 at 15:10
  • Question was edited since i answered to specify a shell or applescript.
    – Mamonu
    May 11, 2013 at 16:10
  • Python is ok as well
    – nohillside
    May 11, 2013 at 16:34

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .