Jump to content

How Do I Add a Link to Clipboard


Recommended Posts

Hi all,

 

I think this is probably simple, but is driving me crazy: I want to create a keystroke to add the url from a Gmail link to Pocket. I've tried both "Add URLs to Pocket" and "Pocket for Alfred" and neither does exactly what I need. "Add URLs" requires that I open the link or right click and "Copy Link Address" to get the URL into the clipboard before I save to Pocket. And "Pocket for Alfred" uses the Pocket website, not the Mac App. The Mac app adds a service to the right-click menu, called "Add to Pocket" but it adds the text not the link. 

 

I was hoping to just add a "copy link to clipboard" step to the 'Add URLs to Pocket' but can't figure out how to do it. 

 

Any help advice, comments, questions?

Edited by OnTheClock
Link to comment

@OnTheClock Apologies I missed your early reply! Thanks for adding your details to your profile :)

 

At this point, I'm not sure how you'd do this (as it partly depends by what you mean by "a Gmail link", and how the Pocket workflows operate) so I'll pop this in the Workflows section to see if fellow users could help. 

 

Take a look at the Hotkey object, which can be used to grab the selected text in macOS to use as argument, which may be a starting point for you:

https://www.alfredapp.com/help/workflows/triggers/hotkey/

 

Cheers,
Vero

Link to comment

Yep, this is my plan -- I just want to highlight a hyperlink in Chrome, press a hotkey that copies the URL into the clipboard and runs this script:

 

ADDCLIP=$(osascript -e "get the clipboard")

open -g pocket://add?url=$ADDCLIP

echo $ADDCLIP

 

I thought it would be super straight-forward, but I can't find a way to copy just the URL. Standard ctrl-C copies the link text in the clipboard, not the link URL.

 

In Safari, I could add a hotkey to the 'Share' menu item, but Chrome doesn't have this. Instead, Chrome has a 'Copy Link Address' menu item. (See attached tiny screenshots).

 

Thanks,

 

Charlie

 

 

59b98fa17e613_ScreenShot2017-09-13at4_03_13PM.png.c91eb7e9a143537657418ba50f9f688b.png

 

59b98fa08f240_ScreenShot2017-09-13at4_04_02PM.png.3028312c88e7b02a752821187360222c.png

Link to comment

If Chrome only puts text on the clipboard, there's not much Alfred can do. 

 

You could try simulating a right-click via AppleScript, but that's very error prone. 

 

Your best bet is provably a Chrome extension or a userscript.

 

Also, your script is broken and shouldn't work properly. You need to URL-encode your argument.

 

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...