I am trying to programmatically invoke an OS X editor from a script which:
- does not add smart quotes or any non-ascii characters while editing
- will work "out of the box" on any standard mac system
- allows the user to click the mouse to position the cursor
Sadly Nano and friends do not allow cursor positioning, and Apple lost its mind with TextEdit upgrades and really destroyed that editor!
My best hope is that there is some programatic way to configure TextEdit to behave as an ASCII editor. Alternatively, is there a third party editor whose license allows that I can include with my script to serve this need?
=====
USAGE CONTEXT
I have a python script that runs 'out-of-the-box' on any mac. Now I want that script to invoke an editor on an ASCII file that I need stay as an ASCII file.
I don't want to require the user to do manual configuring, I want the script to initialize itself. Ideally it would not change any global environment settings, but I can give that second requirement up, if I have no choice.
Best Answer
Any texteditor & textutil
Still intrigued by your problem I found the following solution. There is a Terminal app called
textutil
and it allows to convert richtext to plane text.Use the commandline
textutil
to convert your rich text to normal textYou can also pipe the
textutil
output throughsed
to replace smartquotes and do whatever your want with itBecomes:
Hello, this is rich Text with "smart" quotes