Pierre Posted February 11, 2022 Posted February 11, 2022 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? $ 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!!
giovanni Posted February 11, 2022 Posted February 11, 2022 Hi @Pierre, Welcome! Have you tried to interpose (before pasting) a Replace utility replacing /n with nothing, or space?
Pierre Posted February 11, 2022 Author Posted February 11, 2022 (edited) 26 minutes ago, giovanni said: Hi @Pierre, Welcome! Have you tried to interpose (before pasting) a Replace utility replacing /n with nothing, or space? 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 February 11, 2022 by Pierre
Pierre Posted February 11, 2022 Author Posted February 11, 2022 13 minutes ago, giovanni said: what about adding a backspace 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?
giovanni Posted February 11, 2022 Posted February 11, 2022 (edited) try this, using a script found here. I also added it as an universal action (ie: select link, invoke the Universal Action shortcut, choose "Rich Text URL", paste into google doc) Edited February 12, 2022 by giovanni
Pierre Posted February 11, 2022 Author Posted February 11, 2022 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?
giovanni Posted February 11, 2022 Posted February 11, 2022 2 minutes ago, Pierre said: Does this occur when you try it? I tested and I thought it didn't... I will try again later
giovanni Posted February 12, 2022 Posted February 12, 2022 (edited) 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 February 12, 2022 by giovanni
Pierre Posted February 14, 2022 Author Posted February 14, 2022 You know what, after spending a bit too much time on this time-saving automation, I believe that a less elegant backspace after 0.1 seconds is a wonderful solution. Thank you, so much for your help, @giovanni
deanishe Posted February 14, 2022 Posted February 14, 2022 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.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now