TinyURL Uploader

By Paradox-Paradigm on Jun 18, 2012

Screenshots

Uploads a URL to TinyURL

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

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

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

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

You can download the icon in the image here Direct Download

alias tiny {
  sockclose TinyURL
  set %TinyURL /api-create.php?url= $+ $iif($1,$1,$gettok($cb,1,32))
  set %Tiny~ ~
  sockopen TinyURL tinyurl.com 80
}

on $*:HOTLINK:/^https?\72\/\/\S+/i:*: {
  if ($hotlink(event) == rclick) {
    hotlink -md @URL
  }
}

menu @URL {
  TinyURL:tiny $1
}

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

dialog TinyURL {
  title "TinyURL"
  size -1 -1 125 135
  option dbu
  icon $scriptdir $+ \TinyURL.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 "TinyURL", 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:TinyURL:init:*: {
  $iif(C isin %Tiny,did -c TinyURL 8)
  $iif(M isin %Tiny,did -c TinyURL 9)
}

on *:DIALOG:TinyURL:sclick:*: {
  if ($did == 3) && ($did(2)) {
    sockclose TinyURL
    set %TinyURL /api-create.php?url= $+ $did(2)
    did -o TinyURL 3 1 Uploading...
    sockopen TinyURL tinyurl.com 80
  }
  elseif ($did == 6) && ($did(5)) {
    clipboard $did(5)
  }
  elseif ($did == 7) && ($did(5)) {
    run $did(5)
  }
  elseif ($did == 8) {
    set %Tiny $iif(C isin %Tiny,$remove(%Tiny,C),%Tiny $+ C)
  }
  elseif ($did == 9) {
    set %Tiny $iif(M isin %Tiny,$remove(%Tiny,M),%Tiny $+ M)
  }
}

on *:DIALOG:TinyURL:close:*: {
  sockclose TinyURL
  unset %TinyURL
}

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

on *:SOCKREAD:TinyURL: {
  var %T
  sockread %T
  while ($sockbr) {
    if (http://tinyurl.com/ isin %T) {
      if (%Tiny~) {
        echo -ag 4TinyURL: %T
        unset %Tiny~
      }
      else {
        did -o TinyURL 5 1 %T
        did -o TinyURL 3 1 Upload!
      }
      $iif(C isin %Tiny,clipboard %T)
      $iif(M isin %Tiny,msg $active %T)
      unset %TinyURL
      sockclose TinyURL
      return
    }
    sockread %T
  }
}

Comments

Sign in to comment.
VxD aka DEATHJ0KER   -  Jul 09, 2012

Well done!!! :)

 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.