andi242 Posted April 10, 2013 Share Posted April 10, 2013 (edited) Hi all, this will be my first shared Alfred 2 WF ..please be advised, that I am no scripting expert What I did is to create a WF to make use of my yourls set up (http://yourls.org - custom php script to shorten urls) The WF will grab the frontmost URL in Safari (you might want to change the browser in the script), curl it, and copy the URL to the clipboard as well as posting a notification. Important: Be sure to make the necessary changes in the script. What you need to enter is your URL where yourls is located and your API token. I chose to make Safari the browser of choice, you might want to change that within the script, too. You obviously will need a running installation of YOURLS Here's the download: http://d.pr/f/M7Xo Have fun! Edited April 10, 2013 by andi242 Link to comment
vitor Posted April 10, 2013 Share Posted April 10, 2013 Do you have a github repo for this? There are some details of my PinAdd workflow that I think would be nice additions to this — configuring without the need to manually alter the script, and support for more browsers (each of them needs a different Applescript way of getting the frontmost tab url).If not, would you mind if I took a crack at it? Link to comment
andi242 Posted April 10, 2013 Author Share Posted April 10, 2013 Hey, I don't have a github repo, and I'd be fine with any improvement you may want to add to it. Feel free Link to comment
vitor Posted April 11, 2013 Share Posted April 11, 2013 I think I’m finished (added options to configure without the need for manually editing the file, and support for more browsers). Since I don’t use the service, there’s really not an easy way to test it. Are you interested? This doesn’t really add anything to the script that you’d need, so I can ask for anyone else on the forum, if you prefer. Link to comment
andi242 Posted April 12, 2013 Author Share Posted April 12, 2013 I've seen your post and will reply and test Link to comment
parekh Posted April 12, 2013 Share Posted April 12, 2013 Thanks for your workflow! But is there any way to grab the url from the clipboard instead of Safari? Link to comment
vitor Posted April 12, 2013 Share Posted April 12, 2013 (edited) Is there any way to grab the url from the clipboard instead of Safari? Yes, it’s very simple with bash. There’s probably a way to do this using only applescript, but this also works. On the script, change the line property theURL : "" to be property theURL : (do shell script "pbpaste") then simply delete these lines tell application "Safari" set theURL to URL of current tab of window 1 end tell And it should work like you want. Edited April 16, 2013 by Vítor parekh 1 Link to comment
Davide Posted May 23, 2013 Share Posted May 23, 2013 Thanks for this workflow! Works great! Is it possible to use a custom short url ending? - Example: I open Alfred type yourls enter my preferred short url, e.g. alfred Result: short url is like abc.de/alfred Link to comment
andi242 Posted May 28, 2013 Author Share Posted May 28, 2013 Thanks for this workflow! Works great! Is it possible to use a custom short url ending? - Example: I open Alfred type yourls enter my preferred short url, e.g. alfred Result: short url is like abc.de/alfred ooops, sorry, I did not check the forum for quite a while. did you come up with a solution, yet? Link to comment
Davide Posted May 28, 2013 Share Posted May 28, 2013 No problem, didn't find a solution. Do you have an idea? Link to comment
fncll Posted July 31, 2014 Share Posted July 31, 2014 Is there a working link to this script? I am looking for some code to shorten a link using Applescript and YOURLs... Link to comment
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