Download bitlyButler v1.3
Instant link shortening:
<!-- m -->http://bit.ly/tIuc6K<!-- m -->
New in 1.3
- Added ahk4.me support for Autohotkey links
- Added DockA so GUI can be dragged around
- Fixed a few GUI bugs
- Added check for having internet (removing http Errors)
- Better Feedback function (Appifyer API)
- Added singlemonitor "sticky GUI" support (so it doesn't fall out of the screen)
- Added Mouseover effects for buttons and Header.
...in 1.2
- Added groupboxes to GUI (much better)
- Fixed a few bugs concerning adding private API & hotkeying
- A few silent improvements
- Added a few textbased "easter eggs", we'll see if anyone finds them
... in 1.1
- Goo.gl added
- Traybar menu added
- Improved and extended menus
- Changed icon
- Bugfixes
Features:
- Instant link-shortening
- Three modes: On-demand, always-on & commandline
- Visual and audial feedback
- Configure to work with your own bit.ly-account (or get one)
- Includes access to bit.lyButler's API key(s)
Code:
The code was written in AHK_L. Please note that the below appended code will not work due to missing files, it is solely for the purpose of showing so that you might learn or see the code. The .exe extracts necessary data files (after kindly asking if that's okay) and will be runnable instantly.
Feel free to suggest improvements, use the script or share it with friends!
AHK source code is mostly GUI stuff, but the main functions are the following:
bitlyButler_Shorten(longURL) ; [by RaptorX modified by sumon] { global user, API http := ComObjCreate("WinHttp.WinHttpRequest.5.1"), main := "http://api.bit.ly/v3/shorten?" longURL := urlEncode(longURL) ; Need urlEncode function post := "format=txt&login=" user "&apiKey=" API "&longUrl=" longURL http.open("GET", main . post, false) http.send() return RegexReplace(http.ResponseText, "\r?\n?") } googl(url) ; [by Uberi, under original name of "ShortenURL"] { global API_G http:=ComObjCreate("WinHttp.WinHttpRequest.5.1") main:="https://www.googleapis.com/urlshortener/v1/url" params:="?key=" API_G http.open("POST", main . params, false) http.SetRequestHeader("Content-Type", "application/json") http.send("{""longUrl"": """ url """}") RegExMatch(http.ResponseText, """id"": ""(.*?)""", match) return match1 } ; urlEncode [by RaptorX] urlEncode(url){ f = %A_FormatInteger% SetFormat, Integer, Hex While (RegexMatch(url,"\W", var)) StringReplace, url, url, %var%, % asc(var), All StringReplace, url, url, 0x, `%, All SetFormat, Integer, %f% return url }