Jump to content

How to format a link (text + URL) so that it does not paste with an extra new line at the end


Recommended Posts

Proverbially pulling my hair on this one: With a URL in the clipboard, I want an Alfred Workflow that pastes a link in Google Docs. More specifically, I want a static text to be used as the ~"body", the text should be clickable and clicking on it should open the URL. A basic link. I created a workflow that uses rich text formatting. And it works but when pasting in Google Docs, it adds a new line at the end. It could be that this is the way Google Docs treats incoming rich text from the clipboard. So, I'm wondering if I shouldn't use HTML instead. But I don't know how to make it so that Alfred pastes a link, not raw HTML.

When I copy a link from a webpage, and paste it into Google Docs, it does not add a new line. 

What are my next steps here? How can I make this work?

 

image.thumb.png.ef567556f2091b2adeda0ae351c50a6f.png

 

image.thumb.png.3babdb739f748e893fb1b3772db6e6f7.png

 

$ cat snippet1.rtf
{\rtf1\ansi\ansicpg1252\cocoartf2636
\cocoatextscaling0\cocoaplatform0{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
{\colortbl;\red255\green255\blue255;}
{\*\expandedcolortbl;;}
\paperw11900\paperh16840\margl1440\margr1440\vieww10800\viewh8400\viewkind0
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\pardirnatural\partightenfactor0

\f0\fs29 \cf0 [{\field{\*\fldinst{HYPERLINK "URL_TO_REPLACE"}}{\fldrslt Asana}}]}%


What other elements would you need to help me break through?

 

Thanks a million in advance. Long time user, first time poster :) Love Alfred and the community. Thanks for all your workflows, people!!

Link to comment
26 minutes ago, giovanni said:

Hi @Pierre,

Welcome! Have you tried to interpose (before pasting) a Replace utility replacing /n  with nothing, or space? 

image.thumb.png.312b9c95c9218b3ea1c1fee816170aef.png

 

 

Thank you!

I just tried this and, unfortunately, the problem persists. It's as if Google Docs reads the clipboard, perceives an indication of "rich text" and adds a new line no matter what.

Edited by Pierre
Link to comment
13 minutes ago, giovanni said:

what about adding a backspace

image.png.b99db7a31fadb67d9fc67bddf9f23e70.png

 

It deletes the whole thing, not just the last character for some reason.

Thanks, though.

 

What about placing something other than rich text in the clipboard?

Link to comment

Wow, thank you so much for putting this together. This is incredible.

However, it still adds a new line after pasting 🥺

Does it not for you when you use it with google docs? The problem isn't with my google account, I tried two. Does this occur when you try it?

The problem does not occur in Pages nor TextEdit... Could it be a Google Docs idiosyncratic thing?

Link to comment

you are right @Pierre it still adds a new line. I must have tried it in Word. Adding a 0.1-second delay before backspace works for me (it should work on your own version as well), but not obviously with the universal action. It's hacky but gets you what you want...

Edited by giovanni
Link to comment
On 2/11/2022 at 9:24 PM, Pierre said:

 

It deletes the whole thing, not just the last character for some reason.


The app may be registering that you still have your finger on CMD and be executing CMD+Backspace instead of just Backspace.

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...