Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

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.

Thanks!

share|improve this question
    
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 '13 at 15:28

2 Answers 2

up vote 1 down vote accepted

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.
share|improve this answer
    
Perfect. Thank you! –  Henrik May 11 '13 at 17:23

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
subprocess.call("date")
share|improve this answer
    
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? –  patrix May 11 '13 at 15:10
    
Question was edited since i answered to specify a shell or applescript. –  Mamonu May 11 '13 at 16:10
    
Python is ok as well –  patrix May 11 '13 at 16:34

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.