Code: Select all
command: python
parameters: d:\mypythonscript.py %L
Code: Select all
import pyperclip
import sys
# The path and name of the tempfile is in sys.argv[1]
tempfile = sys.argv[1]
# Open the file and read the lines and put them in a list 's'
with open(tempfile) as file:
s = file.readlines()
# add quotes around text of every line (every item in list 's')
s = ['"' + x.rstrip() + '"' for x in s]
# Join all the list entries in 's' and copy them to clipboard
pyperclip.copy("\n".join(s))