Jump to content

How do I set Alfred up to paste in a URL using a hot key?


Recommended Posts

Hey everyone,

 

I'm a fairly new Alfred user. I've been staring at the menus for a bit, and I can't figure out how to do this one thing.

 

I frequently give out my Zoom link to meet with clients. Every time I do, I have to log into Zoom and go get the URL. I want to just set it so I can hit Option Z (or some other key) and it just pastes the URL wherever my cursor is (FB messenger, for example).

 

Could someone tell me how to do this? I have not set up a workflow so this is all new to me. Oh, and I have a paid account with the power pack and all that.

Edited by Zero Cool
Link to post

It is probably better to use a snippet. Alfred preferences > Features > Snippets. 

 

But, if you really want to use a keyboard shortcut, you can create a workflow with a "Hotkey" action and a "Copy to Clipboard" action.  Do not forget to select the "Automatically paste to front most app" option and you are good to go.

 

 

Screenshot_2020-10-19_07_44_13.png.a9286a790897c14727a6b1b383ca04e2.png

 

 

Before coming with this solution, I thought about about a script triggered by a keyboard shortcut that would copy a string (a url address) to the clipboard then paste it to the frontmost application. Something like this:

 

Quote

echo "http:www.zoom.com" | pbcopy | pbpaste

 

But I do not get why it doesn't paste to the frontmost application. 

 

We need your expertise @deanishe :)

Link to post
7 hours ago, politicus said:

But I do not get why it doesn't paste to the frontmost application. 

 

pbcopy isn’t grabbing the text from the frontmost application either, it’s grabbing the text you’re feeding it. pbpaste isn’t any different, it outputs the text to whatever environment you’re calling it on (i.e. the shell); it barfs the text, it doesn’t interact with applications. Also, you’re piping to it (|) which doesn’t make sense—a pipe is a way to say “use the output of one command as the input of the next” not “do this after”. pbcopy doesn’t produce any output and pbpaste doesn’t accept any input, so pbcopy | pbpaste does nothing (pbpaste | pbcopy technically would, but it would be useless).


http:www.zoom.com is wrong, you’re missing the //.

Link to post

I'm totally lost, but I do appreciate you all chiming in and trying to help.

 

Is there no way to do the thing I want? I paste this URL so often that I just want to set up some kind of easy shortcut to do it without looking it up each time.

Edited by Zero Cool
Link to post

@deanishe I guess so  but thanks to @vitor's answer and a few more trials and errors better understand pbcopy and pbpaste I found a solution. 

 

@vitor Thanks for the explanation.

 

Before trying my solution, I red this article that says: 

 

This (pbpaste) will print whatever data you copied from the pbcopy command or the Finder's copy command (command-c).

  

I also red this article that says:

 

You could grab the output of a grep/awk/sed to paste into IM/IRC.

 

I, then, thought that running my script would copy "http:www.zoom.com" to the clipboard plus, not then, paste the content of the clipboard to the frontmost application. Maybe, I confused "print" with "paste" in the first article. Plus, I didn't know about pbcopy and pbpaste input/output.

 

With your answer in mind and playing around a little more with Alfred actions, I found two different ways to make it work.  

 

(BTW, I am curious to know how you added a grey background to pbcopy).

 

@Zero Cool  Here is the file of the workflow. Download it here, set the keyboard shortcut you want. Replace "htttp://www.yourzoomurl.com" with the url you want in the "Copy to Clipboard" action.

 

I tested it. It works. 

Edited by politicus
Link to post

@politicus - Thank you so much for this. Once I had started reading this thread, I had given up because it seemed to complicated. I really appreciate you sending me the workflow. Made it very easy to do. I just tested it and it works perfectly.

 

And thank you everyone else who replied. I appreciate you taking the time to help.

Link to post

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