• Become a Power user Intro to AutoHotkey Intermediate AutoHotkey Intermediate Objects GUIs are Easy w/AutoHotkey Painlessly switch from V1 to V2

Use AutoHotkey to push clipboard to the Internet for rapid sharing

clipboard to the InternetAutoHotkey Merchandise-White Stress ballI work with people around the planet on a daily basis.  🙂  Being able to quickly share my code with my collaborators is super-easy with this AutoHotkey script that allows me to push my clipboard to the Internet.

Here is a short video demonstrating the script

Code showing how I push my clipboard to the Internet

#SingleInstance, Force
;***********clipbin / ahkbin on ahkscript.org *******************
#c:: ;Windows C will copy selected content, paste to ahkPasteBin and leave URL on your clipboard
	SendPlay, ^c ;copy selected text to clipboard
	ClipWait, 1 ;wait for clipboard to be populated
	If ErrorLevel ;If nothing was copied to clipboard after 1 second
	MsgBox, No text was sent to clipboard ;let user know nothing was copied to clipboard
Clipboard:=mepaste(clipboard,"Your Name") ;Add your Name or just leave blank
ToolTip, The clipboard now has the following URL: %clipboard% ;show tooltip acknowledging URL is on clipboard
SetTimer, RemoveToolTip, 5000 ;hide tooltip after 5 seconds (this is better than "sleep").  Easy to change
;~ run %clipboard% ;Uncomment if you want to have it pop-open in your default browser

;****************Function for pasting to ahkscript.org pastebin****************
	Pbin:=ComObjCreate("WinHttp.WinHttpRequest.5.1") ;create object
	Pbin.Open("POST", "http://p.ahkscript.org/", False) ;set-up POST request
	Pbin.SetRequestHeader("Content-Type", "application/x-www-form-urlencoded") ;set header for API call
	Pbin.Send("code=" UriEncode(Content) . "&name=" UriEncode(Name) . "&announce=on&channel=#ahkscript") ;send payload / Envelope
	if pbin.Status()!=200 { ;if doesn't return 200 then there was a problem
		MsgBox Something went wrong ;let user know something went wrong
	return Pbin.Option(1) ;return url to user
;*********************URI Encode data*****clipboard to the Internet************
UriEncode(Uri, RE="[0-9A-Za-z]"){
	While Code:=NumGet(Var,A_Index-1,"UChar")
;**************Timer to remove tooltip
SetTimer, RemoveToolTip, Off ;disable the timer
ToolTip ;clear the tooltip