Using Ubuntu 14.04 and Python 3.6
I currently have pyperclip installed, works great when creating shortcuts to open files in specific programs. I simply copy file to clipboard and open with specified app shortcut key.
I would like to do the same with ps2pdf except add .pdf to the destination file, in the same directory. No matter what I try, it keeps creating a pdf in my home directory. The correct syntax for ps2pdf is: ps2pdf Original_file.ps Destination_file.pdf
#!/usr/bin/env python3
import subprocess
import pyperclip
first = pyperclip.paste()
#text =`echo "$first" | cut -d'.' -f1`
text = first.substr(0, first.lastIndexOf(".")) + ".pdf";
subprocess.Popen(["ps2pdf", pyperclip.paste() " " text])
I've tried quite a few different variations, and variables, but I don't want to list them all here. Just shows 1 example of what else I've tried.
Any help would be appreciated.
Thank you