Jump to content


  • Posts

  • Joined

  • Last visited

Recent Profile Visitors

155 profile views

rmustard's Achievements

Helping Hand

Helping Hand (3/5)



  1. I ended up changing the starting point of the workflow. Now, I'll invoke the workflow which will essentially populate the hyperlink on the clipboard. Then I'll use <command>-v wherever I want to past the hyperlink. Here's the relevant python code for these actions. //pass in an anchor <a href="protocol://url/to/thing">Name</a> def transformToRTF(html): p = subprocess.Popen(['textutil','-format','html','-convert','rtf','-stdin','-stdout'], stdin=subprocess.PIPE, stdout=subprocess.PIPE) p.stdin.write(html) p.stdin.close() retcode = p.wait() data = p.stdout.read() return data //use various options with pbpaste to get different types of data def getClipboardData(): p = subprocess.Popen(['pbpaste'], stdout=subprocess.PIPE) retcode = p.wait() data = p.stdout.read() return data //use various options with pbcopy to set the type of data on the clipboard def setClipboardData(data): p = subprocess.Popen(['pbcopy','Prefer','rtf'], stdin=subprocess.PIPE) p.stdin.write(data) p.stdin.close() retcode = p.wait()
  2. I'm trying to create a workflow to transform some text into a hyperlink and automatically paste it. I've copied some text to the clipboard that contains the bits that I need to form the URL. I have a script to create the URL and I can pass it to the Copy to Clipboard Output. But it's still just the URL text. I can modify the script to hack the URL into an RTF snippet. If I push the snippet on the clipboard in the script, I can paste it as a hyperlink, so I know it works. But, if I just pass the RTF data as text to Copy to Clipboard it doesn't paste as a hyperlink (just the RTF code as text). Anybody know if I'm approaching this wrong or if there's a way to programmatically create a hyperlink and automatically paste it to the front most app?
  • Create New...