Text development using Mac services

A service that evaluates and rewrites a text selection in Python

I read the following blog and was impressed with the Python version. (The following article is the Ruby version)

I'll write a note if it's easy for Pythonistas to see.

Reference site

-Two features you should definitely use if you're using a Mac "Automator" and "Services"

--Debugging Automator

Start Automator and create a new service

You can create it as shown in the screen below.

service.png

I will also paste the code so that it is easy to copy.

python -S 2>&1 || echo;

Set shortcuts from the Preferences keyboard

Set as shown in the screen below.

shortcut.png

use

The point is that you can use any text that can be passed to Automator.

It can also be used from the right-click menu or as a shortcut.

The following is the one used in CotEditor. It can also be used as a substitute for a calculator. (Run from right-click menu)

cal_cot_edit02.gif

I used it on MacDown. It is also convenient for creating serial numbers that you do not want to do manually. (Run with shortcut)

loop02.gif

Summary

Why not try using the services of the original article for Rubyist and this article for Pythonista.

Recommended Posts

Text development using Mac services
Build a Django development environment using pyenv-virtualenv on Mac
WEB application development using django-Development 1-
Using OpenCV with Python @Mac
WEB application development using Django [Application addition]
Checklist using Checkbox Treeview → Text creation
(Beginner) Notes on using pyenv on Mac
Application development using Azure Machine Learning