Add quotes around cm_CopyFullNamesToClip

English support forum

Moderators: Hacker, petermad, Stefan2, white

raytc
Senior Member
Senior Member
Posts: 274
Joined: 2004-06-28, 11:03 UTC

Re: Add quotes around cm_CopyFullNamesToClip

Post by *raytc »

This is my solution in Python:

Code: Select all

command: python
parameters: d:\mypythonscript.py %L
mypythonscript.py:

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))
Post Reply