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!

有帮助吗?

解决方案

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
subprocess.call("date")
许可以下: CC-BY-SA归因
不隶属于 apple.stackexchange
scroll top