imgur Uploader

Platform:  mIRC
Published  Jun 10, 2012
Updated  Jan 23, 2013

Screenshots

Uploads a URL image to imgur

- Dialog - Right-click in a channel, status or query window & click 'imgur' then enter the URL into the uploading edit box & click 'Upload!'

- Alias - Type '/imgur' to upload from your clipboard or '/imgur {URL here}', The script will echo the imgur URL to the active window (Does not write to your mIRC logs)

Alias only version (No dialog) - http://pastebin.com/xN3VKgNH

Bot version (For a bot) - http://pastebin.com/XHxPqY5S

You can download the icon in the image here Direct Download alias imgur {
sockclose imgur
set %imgurURL /upload?url= $+ $iif($1,$1,$gettok($cb,1,32))
set %imgurI . $+ $gettok($gettok($iif($1,$1,$gettok($cb,1,32)),-1,46),1,63)
set %imgur~ ~
sockopen imgur imgur.com 80
}

on $*:HOTLINK:/^https?\72\/\/\S+\.((pn|jpe?)g|gif|bmp)/i:*: {
if ($hotlink(event) == rclick) {
hotlink -md @URL
}
}

menu @URL {
imgur:imgur $1
}

menu channel,status,query {
imgur:dialog -m imgur imgur
}

dialog imgur {
title "imgur"
size -1 -1 125 135
option dbu
icon $scriptdir $+ \imgur.ico, 0
text "URL to Upload", 1, 45 2 34 8
edit "", 2, 2 11 121 10, autohs
button "Upload!", 3, 5 24 115 30, default
text "imgur URL", 4, 50 56 24 8
edit "", 5, 22 65 80 10
button "Clipboard", 6, 7 78 45 12
button "Open In Browser", 7, 58 78 60 12
check "Clipboard URL Automatically", 8, 20 95 75 8
check "Message Active Window", 9, 20 105 66 8
button "Exit", 10, 37 115 50 15, cancel
}

on *:DIALOG:imgur:init:*: {
$iif(C isin %imgur,did -c imgur 8)
$iif(M isin %imgur,did -c imgur 9)
}

on *:DIALOG:imgur:sclick:*: {
if ($did == 3) && ($did(2)) {
sockclose imgur
set %imgurURL /upload?url= $+ $did(2)
set %imgurI . $+ $gettok($gettok($did(2),-1,46),1,63)
did -o imgur 3 1 Uploading...
sockopen imgur imgur.com 80
}
elseif ($did == 6) && ($did(5)) {
clipboard $did(5)
}
elseif ($did == 7) && ($did(5)) {
run $did(5)
}
elseif ($did == 8) {
set %imgur $iif(C isin %imgur,$remove(%imgur,C),%imgur $+ C)
}
elseif ($did == 9) {
set %imgur $iif(M isin %imgur,$remove(%imgur,M),%imgur $+ M)
}
}

on *:DIALOG:imgur:close:*: {
sockclose imgur
unset %imgurI
unset %imgurURL
}

on *:SOCKOPEN:imgur: {
sockwrite -n imgur GET %imgurURL HTTP/1.1
sockwrite -n imgur Host: imgur.com
sockwrite imgur $crlf
}

on *:SOCKREAD:imgur: {
var %i
sockread %i
while ($sockbr) {
if (Location: isin %i) {
var %i = $replace($gettok(%i,2,32),http://,http://i.) $+ %imgurI
if (http://i.imgur.com/?error isin $gettok(%i,2,32)) {
$iif(%imgur~,echo -ag 4Imgur:,did -o imgur 5 1) Invalid URL
$iif(!%imgur~,did -o imgur 3 1 Upload!)
unset %imgur~
}
elseif (%imgur~) {
echo -ag 4Imgur: %i
unset %imgur~
}
else {
did -o imgur 5 1 %i
did -o imgur 3 1 Upload!
}
$iif(C isin %imgur,clipboard %i)
$iif(M isin %imgur,msg $active %i)
unset %imgurI
unset %imgurURL
sockclose imgur
return
}
sockread %i
}
}

Comments

Sign in to comment.
Paradox-Paradigm   -  Jun 10, 2012
Yeah, it works now, better too
 Respond  
SunnyD   -  Jun 10, 2012
Ah, ok. I have a friend that goes by Paradox/Paradigm on occasion. But yeah, I think something along those lines is what you're looking for.
 Respond  
Paradox-Paradigm   -  Jun 10, 2012
Thanks for the tip, i'll see what i can do

I use Paradox & Paradigm
 Respond  
SunnyD   -  Jun 10, 2012

Quote

Known Errors: History won't update if any character is deleted or added to the history edit box

Replace the edit box with a component more conducive to its function; like a combo box or a list/edit-box combination. I made a snippet a long time ago to, more or less, save links and then recall them using lists to select an entry.

Also, what server are you on? Your name seems familiar.
 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.