Jump to content

[Request] Copy current webpage URL to clipboard


Recommended Posts

This is pretty straightforward ... for Safari at least.

 

Make a new workflow, from "Templates"\"Essentials"\"Keyword to script"

 

Double click on Keyword in the workflow area and set up your keyword  with no argument, then save.

 

Double click on Run Script and in the language drop down select /usr/bin/osascript.

in the Script area paste this:

 

 

tell application "Safari"
  activate
          set theURL to URL of front document
  set the clipboard to theURL & return
end tell
 

then click save.

 

Then load whatever site you want in Safari, open alfred and type your keyword and you will have Safari's url on the clipboard.

Link to comment

Thanks, that worked for Safari.

 

Tried changing "Safari" to "Chrome" but that did not work.

 

Try this for Chrome:

tell application "Google Chrome"
	set theURL to the URL of the active tab of window 1
	set the clipboard to theURL
end tell
Link to comment
  • 5 months later...

But I'm not sure this is possible in Chrome due to their lack of applescript support.

What makes you think that? Its applescript support is pretty acceptable, and nothing to scoff at. It’s a lot better than a big percentage of apps out there, and certainly better than the majority of browsers, which range from having none to ridiculously deficient applescript support.

 

It’s a genuine question, though, what makes you feel its applescript support is poor?

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