Search Icon, Magnifying Glass

Marmanold.com

Graduation CapHeartQuestion MarkMagnifying Glass

Alfred 3 Firefox URL Copy

Wed, May 24, 2017

I’ve been an Alfred user for many years, but until I moved to LifeWay, I’d never had the opportunity to use a Macintosh — and thus Alfred — as part of my daily work. For me, Alfred was always about quick launching applications, doing quick calculations, and checking the spelling and definition of words. Thanks to my daily use at LifeWay and the guidance of the Mac Power Users, I’ve upped my Alfred game significantly over the last several months. Today, I’m going to share one of the many Alfred workflows I’ve come to rely on.

As an IT manager a large part of my job is sharing information with others. Be it Slack, e-mail, tweet, iMessage, you name it I’m constantly needing to share the URL of the thing I was just looking at in Firefox with someone else. Prior to this workflow, I would have to lose focus from the communication task at hand, ALT-TAB to Firefox, click the URL, ⌘c, ALT-TAB back to where I was at, and then ⌘v.

To simplify this process and make it where I no longer need to lose focus from what I’m trying to say, I’ve created an Alfred workflow that kicks off some AppleScript to do this all for me. I simply activate Alfred, type furl, and Alfred does the rest. Without my hands leaving the keyboard and without my mind losing focus, I’m able to copy the URL for the active tab in Firefox to the clipboard. I still need to ⌘v, but that’s personal preference; AppleScript could easily do that for me. The amount of time and focus I retain each day with this workflow is unimaginable!

I’ve posted the binary workflow file for Alfred 3 to GitHub for you to try out yourself. The AppleScript to do all of this work is embedded in the workflow, included separately in the repo, and shown below for your viewing pleasure.


on alfred_script(q)
tell application "System Events"
	set activeApp to name of first application process whose frontmost is true
end tell
tell application "Firefox" to activate
tell application "System Events"
	keystroke "l" using {command down}
	keystroke "c" using {command down}
end tell
tell application activeApp to activate
return the clipboard
end alfred_script
Tags: #automation #alfred #firefox #url #applescript