URL shortener

By Fuzionx on Jan 16, 2011

The getsource part of this script is from Chessnut's $getsource script. Credits for that part goes to him!

This script shortens your links using rly.cc, it will copy the link to your clipboard.
Usage: /short [link]
If there is no link specified, a window will pop up asking which link you want to short.

alias short {
  var %l, %u $iif(http://* !iswm $1,http://) $+ $iif($1,$1,$?="What link do you want to short?"), $&
    %comName getSource. $+ $ticks
  .comopen %comName msxml2.xmlhttp
  noop $com(%comName,Open,1,bstr,GET,bstr,$+(http://rly.cc/s/mini-api.php?u=,%u),bool,false)
  noop $com(%comName,Send,1)
  noop $com(%comName,ResponseText,2)
  %l = $com(%comName).result
  .comclose %comName
  echo -at Short URL: $qt($+($chr(3),10,%u,$chr(3))) ( $+ $len(%u) $+ ) -> $+($chr(3),10,%l,$chr(3)) ( $+ $len(%l) $+ )
  clipboard %l
}

Comments

Sign in to comment.
brbcoding   -  Sep 15, 2012

This is an awesome script... Works absolutely perfectly. I want to make it work with my shortening service but don't really have any idea where to start.

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.