Jump to content

Archived

This topic is now archived and is closed to further replies.

chain

TinyURL

Recommended Posts

  • Administrators
This script will upload a URL to TinyURL

Created by Paradox (Paradigm- on freenode)

 

---------------

 

There are 3 ways to use the script

 

- The dialog/GUI - Type '/tiny' or right-click in a channel/status/query window & click 'TinyURL' then enter the URL in the uploading edit box & click 'Upload!', The last 14 URLs the script has made (Any URL created by any usage of this script is added to the history) & there are also some options

 

- The alias - Type '/tiny {URL Here}' to have the script echo the TinyURL to the active window (Does not write to your mIRC logs), you can also specify a switch 'C' to copy the URL to your clipboard & 'M' to message the active window (Swtiches are not case sensitive)

 

- The command prompt - Other users can use the script by typing '~tiny {URL Here}' (The ~ can be any non-alphanumeric character) & the URL will either be sent to the channel if it was prompted from a channel or noticed to the nick if it was from a query/notice

 

---------------

 

You can download the icon in the image here Direct Download

 

---------------

 

A variable explanation for script editors

 

%Tiny - Clipboard & Messaging Channel/Active boolean options

%Tiny~ - If '/Tiny ' was used

%TinyURL - URL to be uploaded to TinyURL

%TinyM - Channel/Nick to message if option is enabled in dialog

%TinyT - Nick to notice or Channel to message if activated by command prompt

 

%TinyH - Upload History

 

>alias tiny {  if ($1 != $null) {    sockclose TinyURL    set %TinyURL /api-create.php?url= $+ $1    $iif($2 != $null,set %Tiny %Tiny $+ $iif(C isin $2-,T) $+ $iif(M isin $2-,D))    set %Tiny~ T    sockopen TinyURL tinyurl.com 80  }  else {    dialog -m TinyURL TinyURL  }}menu channel,status,query {  TinyURL:dialog -m TinyURL TinyURL}dialog TinyURL {  title "TinyURL"  size -1 -1 130 205  option dbu  icon $scriptdir $+ \TinyURL.ico, 0  text "URL to Upload", 1, 46 2 34 8  edit "", 2, 2 11 126 10, autohs  button "Upload!", 3, 5 24 120 30, default  text "TinyURL", 4, 52 56 24 8  edit "", 5, 25 65 80 10, autohs  button "Clipboard", 6, 10 78 45 12  button "Open In Browser", 7, 60 78 60 12  text "History", 8, 56 92 17 8  combo 9, 20 100 90 55, multi  check "Copy URL To Clipboard Automatically", 10, 16 155 96 8  check "Message to:", 11, 16 167 37 8  edit "", 12, 55 166 58 10, autohs  text "Leave Blank To Message The Open Window", 13, 13 178 104 8  button "Exit", 14, 40 187 50 15, cancel}on *:DIALOG:TinyURL:init:*: {  tokenize 32 %TinyH  var %x = 1  while (%x < 15) {    did -o TinyURL 9 %x $eval($ $+ %x,2)    inc %x  }  if (C isin %Tiny) {    did -c TinyURL 10  }  if (M isin %Tiny) {    did -c TinyURL 11  }  if (%TinyM != $null) {    did -o TinyURL 12 1 %TinyM  }}on *:DIALOG:TinyURL:sclick:*: {  if ($did == 3) && ($did(2) != $null) {    sockclose TinyURL    set %TinyURL /api-create.php?url= $+ $did(2)    did -o TinyURL 3 1 Uploading...    sockopen TinyURL tinyurl.com 80  }  elseif ($did == 6) {    clipboard $did(5)  }  elseif ($did == 7) {    run $did(5)  }  elseif ($did == 10) {    set %Tiny $iif(C isin %Tiny,$remove(%Tiny,C),%Tiny $+ C)  }  elseif ($did == 11) {    set %Tiny $iif(M isin %Tiny,$remove(%Tiny,M),%Tiny $+ M)  }}on *:DIALOG:TinyURL:edit:12: {  $iif($did(12) != $null,set %TinyM $v1,unset %TinyM)}on *:DIALOG:TinyURL:close:*: {  sockclose TinyURL  unset %TinyURL}on $*:TEXT:/^[^a-z]tiny(url)? \S+$/i:*: {  sockclose TinyURL  set %TinyT $iif($chan != $null,msg $chan,.notice $nick)  set %TinyURL /api-create.php?url= $+ $2  sockopen TinyURL tinyurl.com 80}on $*:NOTICE:/^[^a-z]?tiny(url)? \S+$/i:?: {  sockclose TinyURL  set %TinyT .notice $nick  set %TinyURL /api-create.php?url= $+ $2  sockopen TinyURL tinyurl.com 80}on *:SOCKOPEN:TinyURL: {  sockwrite -nt $sockname GET %TinyURL HTTP/1.1  sockwrite -nt $sockname Host: tinyurl.com  sockwrite -nt $sockname $crlf}on *:SOCKREAD:TinyURL: {  var %x  sockread %x  while ($sockbr) {    if (http://tinyurl.com/ isin %x) {	  if (%Tiny~ == $null) && (%TinyT == $null) {	    did -o TinyURL 5 1 %x	    $iif(C isin %Tiny,clipboard %x)	    $iif(M isin %Tiny,msg $iif($did(TinyURL,12) != $null,$v1,$active) %x)	    did -o TinyURL 3 1 Upload!	    tokenize 32 %TinyH	    var %h = 1	    while (%h < 15) {		  did -o TinyURL 9 %h $eval($ $+ %h,2)		  inc %h	    }	  }	  elseif (%Tiny~ != $null) {	    echo -ag 4TinyURL: %x	    $iif(T isin %Tiny,clipboard %x)	    $iif(D isin %Tiny,msg $active %x)	    set %Tiny $remove(%Tiny,T,D)	    unset %Tiny~	  }	  else {	    %TinyT %x	    unset %TinyT	  }	  set %TinyH %x $iif($count(%TinyH,http://) >= 15,$deltok(%TinyH,15,32),%TinyH)	  unset %TinyURL	  sockclose $sockname	  return    }    sockread %x  }}

Link to comment
Share on other sites



×
×
  • Create New...