Pass the selected text as an argument to a python3 using shell

I have a python script which does some text processing and prints the output.
I want to create an extension to pass the selected string as argument to that script and run that script in iterm2 itself.
Any Idea how to do that ?

Hmm Iā€™m not sure how we could make it run in in a certain shell other than for PopClip to maybe type the command into the shell window using AppleScript UI scripting. Could use pbpaste to get the selected text into it.

1 Like