Top

Kirby's PasteBin Uploader/Downloader


mIRC Code
+ 10 likes
Please Register to submit score.
Bookmark and Share
Average Score  8.8 (of 10 scores)
Date Added  May 19, 2009
Last Updated  May 19, 2009
Tags  bin  dialog  download  downloader  kirby  mirc  paste  pastebin  socket  upload  uploader 

Introduction

Hey guys. I haven't posted a snippet in a while, so here's one!
For a while I've been working with sockets and dialogs, and more recently, regular expressions; but this one has been very interesting for me.

I script often, so I have to use PasteBin consistently. I've also seen a few PasteBin scripts here on Hawkee, such as Pastebin (Uploader) by H_M and PasteBin Saver/Script Loader by NIGathan.
They both work effectively, but one is an uploader, and another is a downloader.

Then I thought to myself, "Why not combine both?"
Well here it is: a PasteBin Uploader and Downloader.


Onto the code.


"So, how can I use this?"
Syntax: /pastebin to open up the dialog.
I've tried to make it as user-friendly as possible, but maybe it's not for some of you. So, here's some elaboration!
As you can see in the screen-shot below, the dialog itself is pretty massive. Plus, there are no tabs.

"So, how does uploading and downloading work?"
For uploading, you can upload existing files or paste them directly into the large edit box. You can add your name, a custom sub-domain name (for private pasting), how you want PasteBin to read your paste (72 languages to choose from), when you want your paste to expire, and much more!
For downloading, you can do two things. Firstly, you can simply preview it. Previewing is simply looking at the paste; no saving to your files or anything. This can be useful because if you save every single time to view a paste, it can waste your hard disk space. Secondly, you can download it. All files are downloaded to a folder called "PasteBin" in your mIRC Directory. If the paste was private, separate folders inside the folder "PasteBin" will be created, along with a modification of a file name depending on the type of paste (language syntax highlighting). You can also check the "Load to remotes?", to...load the paste to your remotes.

"What other features are available?"
The dialog is pretty much this:
  • An uploading section
  • A downloading section
  • An information box
  • A very large edit box
  • A few buttons all around

Here are some features:
  • Choose own name for uploading
  • Options of private pasting (custom sub-domain names)
  • 72 language highlighting options
  • Selection of post expiry
  • Importing (browsing) existing files
  • Option to load paste to remote
  • Clearing the screen
  • Copying selected text or all text to the clipboard
  • "Go to Nth line..." option
  • many more!

So, I guess it's pretty self-explanatory.

*** Note: If you haven't used PasteBin before, I suggest following that link and testing it out for yourself before you test this dialog.

One more thing I would like note:
Use mIRC Version 6.34+ or many parts will not work! Enhancements with storage of variables and many other updates have been made in the newer versions, so hence, users with older mIRC versions will experience problems!

Some people I would like to give credits to:
  • Firstmate for giving me crucial advice on a "on sockwrite" event, which allows faster + safer pasting (especially on large pastes).
  • Blitzjager for taking a nice screen-shot for me (since my theme is terrible).


Here's a picture:


Enjoy!

Grab the Code

alias pastebin dialog $iif($dialog(pastebin),-v,-m) pastebin pastebin
 
alias -l ab2word { var %x PasteBin\languages.txt, %y PasteBin\abbreviations.txt | noop $read(%y,w,$1) | return $iif($read(%x,$readn),$v1) }
alias -l between { noop $regex($1,/\Q $+ $2 $+ \E(.*?)\Q $+ $3 $+ \E/gi) | return $regml($4) }
alias -l hex { return $regsubex($1-,/([^\d\w])/gi,$+(%,$base($asc(\1),10,16))) }
alias -l pwrite { var %x $1 | tokenize 124 $2- | write $+(PasteBin\,%x) $* }
alias -l uber { return $replace($regsubex($regsubex($1,/&#(x?([a-f\d]*));/gi,$chr($iif($left(\1,1) == x,$base(\2,16,10),\2))),/(^[^<]*>|<[^>]*>|<[^>]*$)/g,$null),&lt;,<,&gt;,>,&quot;,",&amp;,&) }
alias -l word2ab { var %x PasteBin\languages.txt, %y PasteBin\abbreviations.txt | noop $read(%x,w,$1) | return $iif($read(%y,$readn),$v1) }
 
menu * {
  PasteBin Uploader/Downloader : pastebin
}
 
dialog pastebin {
  title "Pastebin Uploader / Downloader"
  size -1 -1 454 375
  option dbu
  box "Upload:", 1, 5 2 232 84
  text "Name:", 2, 14 11 16 8
  edit "", 3, 33 10 67 10, autohs limit 24 center
  text "Private sub-domain:", 4, 109 11 49 8
  edit "", 5, 160 10 68 10, autohs limit 50 center
  text "Syntax highlighting:", 6, 26 25 48 8
  combo 7, 81 24 75 62, sort size drop
  check "Private Paste?", 8, 171 24 45 10
  button "Browse file...", 9, 11 51 42 12
  edit "", 10, 61 52 170 10, autohs center
  text "How long should your post be retained?", 11, 19 39 96 8
  radio "a day", 12, 126 38 24 10
  radio "a month", 13, 157 38 30 10
  radio "forever", 14, 195 38 28 10
  button "Preview!", 15, 53 68 50 12
  button "Upload!", 16, 135 68 50 12
  box "Download:", 17, 237 2 213 37
  text "Pastebin URL:", 18, 244 10 34 8
  edit "", 19, 280 9 106 10, autohs center
  check "Load to remotes?", 20, 393 9 52 10
  button "Preview", 21, 273 22 50 12
  button "Download!", 22, 362 22 50 12
  edit "", 23, 5 90 443 261, multi return hsbar vsbar
  box "Information:", 24, 237 36 213 50
  text "", 25, 243 43 201 39
  button "Close Dialog", 26, 38 356 60 14
  button "Clear Screen", 27, 142 356 60 14
  button "Copy to Clipboard", 28, 248 356 60 14
  button "Go to line...", 29, 353 356 60 14
  link "", 30, 256 49 188 7
}
 
on *:dialog:PasteBin:*:*: {
  if ($devent == init) {
    $iif(!$isdir(PasteBin),mkdir PasteBin)
    if (!$isfile(PasteBin\abbreviations.txt)) || (!$isfile(PasteBin\languages.txt)) {
      $iif($input(Please wait while 72 languages and their abbreviations are being downloaded.,io,Please wait... :-D),dialog -x PasteBin PasteBin)
      hadd -m PasteBin Ticks $ticks | hadd -m PasteBin Version Load
      sockopen pastebin pastebin.com 80
    }
    $iif($dialog(PasteBin),did -a PasteBin 25 $+(Status: Ready!,$crlf,Credits: PasteBin Software developed by Paul Dixon))
    if ($isfile(PasteBin\languages.txt)) {
      loadbuf -o PasteBin 7 Pastebin\languages.txt
      did -c PasteBin 7 47 | did -c PasteBin 13 | did -b PasteBin 5,15-16,21-22
    }
    hadd -m PasteBin Expiry m
  }
  if ($devent == sclick) {
    if ($did == 8) { did $iif($did(8).state,-e,-b) PasteBin 5 }
    if ($did == 9) {
      if ($sfile(*.txt,Choose a file to upload)) {
        var %x 1, %y $did(23).lines, %z $qt($v1)
        while (%x <= %y) {
          if ($did(23,%x)) {
            $iif($input(It appears that text exists in the box. Are you sure you want to continue?,yi,Warning!),did -r PasteBin 23,halt)
            break
          }
          inc %x
        }
        loadbuf -o PasteBin 23 %z
        did -ra PasteBin 10 %z | did -e PasteBin 16 | did -c PasteBin 10 1 | did -cf PasteBin 23 1
      }
    }
    if ($did isnum 12-14) {
      hadd -m PasteBin Expiry $mid($gettok($did($did),$numtok($did($did),32),32),1,1)
      did -a PasteBin 25 $+(Status: Ready!,$crlf,Post Expiry ~ $did($did),:,$chr(32),Good for $iif($did == 12,IRC or IM conversations,$iif($did == 13,email conversations / temporary data,$iif($did == 14,long term archival of useful snippets))))
    }
    if ($did == 15) {
      var %x 1, %y $did(23).lines, %z $qt($did(10))
      while (%x <= %y) {
        if ($did(23,%x)) {
          $iif($input(It appears that text exists in the box. Are you sure you want to continue?,yi,Warning!),did -r PasteBin 23,halt)
          break
        }
        inc %x
      }
      loadbuf -o PasteBin 23 %z
      did -ra PasteBin 10 %z | did -r PasteBin 30 | did -e PasteBin 16 | did -c PasteBin 10 1 | did -cf PasteBin 23 1
    }
    if ($did == 16) {
      savebuf -o PasteBin 23 Pastebin\pb.tmp
      hadd -m PasteBin Ticks $ticks | hadd -m PasteBin Version Upload
      hadd -m PasteBin Tags $+(parent_id=&format=,$word2ab($did(PasteBin,7)),&paste=Send&poster=,$did(PasteBin,3),&expiry=,$hget(PasteBin,Expiry),&code2=)
      sockopen pastebin $+($regsubex($iif(!$did(5).enabled,$null,$iif($did(5) == .,$null,$iif($did(5),$v1,$null))),(^\.(.+)\.$|^(.+)\.$|^\.(.+)$|^(.+)$),$+(\2,.)),pastebin.com) 80
      did -a PasteBin 25 Status: Submitting data towards $+($regsubex($iif(!$did(5).enabled,$null,$iif($did(5) == .,$null,$iif($did(5),$v1,$null))),(^\.(.+)\.$|^(.+)\.$|^\.(.+)$|^(.+)$),$+(\2,.)),pastebin.com) ...
      did -b PasteBin 16,23 | did -r PasteBin 30
    }
    if ($did == 20) { $iif($regex($did(19),^http:\/\/((.*)\.)?(pastebin)\.com\/(\w+)),did $iif($did(20).state,-b,-e) PasteBin 21) }
    if ($did isnum 21-22) {
      var %x 1, %y $did(23).lines
      while (%x <= %y) {
        if ($did(23,%x)) {
          $iif($input(It appears that text exists in the box. Are you sure you want to continue?,yi,Warning!),did -r PasteBin 23,halt)
          break
        }
        inc %x
      }
      noop $regex($did(19),http:\/\/((.*)\.)?(pastebin|pastebin)\.com\/(.*))
      $iif($regml(4),$iif(!$isdir($+(PasteBin\,$regml(2))),mkdir $+(Pastebin\,$regml(2))))
      $iif($did == 22,$iif($isfile($+(PasteBin\,$iif($regml(4),$+($regml(2),\)),$iif($regml(4),$v1,$regml(2)),.txt)),$iif(!$input(The file $qt($iif($regml(4),$v1,$regml(2))) in directory $qt($iif($regml(4),$+(PasteBin\,$regml(2)),PasteBin)) already exists. If you continue the file will be overwritten. Are you sure you want to continue?,yi,Warning!),halt,.remove $+(PasteBin\,$iif($regml(4),$+($regml(2),\)),$iif($regml(4),$v1,$regml(2)),.txt))))
      noop $regex($did(19),http:\/\/((.*)\.)?(pastebin|pastebin)\.com\/(.*))
      hadd -m PasteBin Ticks $ticks | hadd -m PasteBin Version Download | hadd -m PasteBin Method $iif($did == 21,Preview,Download)
      sockopen pastebin pastebin.com 80 | sockmark pastebin $iif($regml(4),$regml(2) $v1,$regml(2))
      did -b PasteBin 15-16,19-23 | did -a PasteBin 25 Status: Connecting to $did(19) ... | did -r PasteBin 30
    }
    if ($did == 26) { dialog -x PasteBin PasteBin }
    if ($did == 27) { did -r PasteBin 3,5,10,19,23 | did -b PasteBin 15-16,21-22 | did -u Pastebin 8,12-14,20 | did -c PasteBin 7 47 | did -c PasteBin 13 | did -a PasteBin 25 $+(Status: Cleared screen!) }
    if ($did == 28) {
      if ($did(23).seltext) {
        did -a PasteBin 25 $+(Status: Copied selected text to clipboard!,$crlf,Size: $bytes($len($v1),b) bytes,$crlf,Number of lines: $iif($count($v1,$crlf),$v1,1))
        clipboard $v1 | halt
      }
      clipboard $null
      var %x 1, %y $did(23).lines
      while (%x <= %y) {
        var %z $calc(%z + ($len($did(23,%x)) + 2))
        clipboard -an $did(23,%x)
        inc %x
      }
      did -a PasteBin 25 $+(Status: Copied all text to clipboard!,$crlf,Size: $bytes(%z,b) bytes,$crlf,Number of lines: $did(23).lines)
    }
    if ($did == 29) {
      var %x $input(Enter a line number $iif($did(23).lines == 1,$null,from 1 to $did(23).lines) to go to...,ei,Go To Line)
      did -cf PasteBin 23 $iif($abs(%x) isnum 1- $did(23).lines,$v1,$iif($abs(%x) > $did(23).lines,$v2,$iif(!$abs(%x),1)))
    }
    if ($did == 30) { clipboard $did(30) }
  }
  if ($devent == rclick) && ($did == 30) { clipboard $did(30) }
  if ($devent == dclick) && ($did == 30) { run $did(30) }
  if ($devent == edit) {
    if ($did == 3) && ($regex($did(3),/[^\w\-]/ig)) { did -ra PasteBin 3 $regsubex($did(3),/([^\w\-])/ig,$null) }
    if ($did == 5) {
      if ($regex($did(5),/[^\w\-\.]/ig)) || ($regex($did(5),/\.{2}/)) { did -ra PasteBin 5 $regsubex($regsubex($did(5),/[^\w\-\.]/ig,$null),/\.{2}/g,.) }
    }
    if ($did == 10) { did $iif($isfile($qt($did(10))),-e,-b) PasteBin 15 }
    if ($did == 19) { did $iif($regex($did(19),^http:\/\/((.*)\.)?(pastebin)\.com\/(\w+)),-e,-b) PasteBin 21-22 }
    if ($did == 23) {
      did $iif($did(23),-e,-b) PasteBin 16
      did -a PasteBin 25 $+(Status: Ready!,$crlf,Note: To highlight particular lines,$chr(44),$chr(32),prefix each line with @@)
    }
  }
  if ($devent == close) { hfree PasteBin | unset %pb }
}
 
on *:sockopen:pastebin: {
  if ($hget(PasteBin,Version) == Download) || ($hget(PasteBin,Version) == Load) {
    tokenize 32 $sock(pastebin).mark
    sockwrite -n $sockname GET $+(/,$iif(!$1,$null,$iif(!$2,$1,$2))) HTTP/1.1
    sockwrite -n $sockname Host: $+($iif(!$1,$null,$iif($2,$+($1,.))),pastebin.com)
    sockwrite -n $sockname $crlf
  }
  elseif ($hget(PasteBin,Version) == Upload) {
    var %x 1, %y $did(PasteBin,23).lines
    while (%x <= %y) {
      var %z $calc(%z + $len($hex($did(PasteBin,23,%x))))
      inc %x
    }
    sockwrite -n $sockname POST /pastebin.php HTTP/1.1
    sockwrite -n $sockname Host: $+($regsubex($iif(!$did(Pastebin,5).enabled,$null,$iif($did(PasteBin,5) == .,$null,$iif($did(PasteBin,5),$v1,$null))),(^\.(.+)\.$|^(.+)\.$|^\.(.+)$|^(.+)$),$+(\2,.)),pastebin.com)
    sockwrite -n $sockname Content-Type: application/x-www-form-urlencoded
    sockwrite -n $sockname Content-length: $calc($len($hget(PasteBin,Tags)) + %z + (3 * %y))
    sockwrite $sockname $crlf
    sockwrite $sockname $hget(PasteBin,Tags)
    hinc -m PasteBin Buffer
  }
}
 
on *:sockwrite:pastebin: {
  if ($hget(PasteBin,Version) == Upload) && ($hget(PasteBin,Buffer) <= $did(PasteBin,23).lines) {
    sockwrite $sockname $+($hex($did(PasteBin,23,$hget(PasteBin,Buffer))),%,0A)
    hinc -m PasteBin Buffer
  }
}
 
on *:sockread:pastebin: {
  tokenize 32 $sock(pastebin).mark
  sockread %pb
  if (!$1) {
    if ($regex(%pb,<select name="format">)) && ($hget(PasteBin,Version) == Load) {
      var %x $regsubex($between(%pb,$+($str(-,28),</option>),</select>,1),/<option value="(.*?)">(.*?)</option>/g,$+(\1,$chr(124))), %y $regsubex($between(%pb,$+($str(-,28),</option>),</select>,1),/<option value="(.*?)">(.*?)</option>/g,$+(\2,$chr(124)))
      pwrite abbreviations.txt %x | pwrite languages.txt %y
      sockclose pastebin
      dialog -m PasteBin PasteBin
      did -a PasteBin 25 $+(Status: Downloaded text files,$crlf,Total estimated time: $calc(($ticks - $hget(PasteBin,Ticks))/1000) seconds)
    }
    elseif ($regex(%pb,Location:(.*))) && ($hget(PasteBin,Version) == Upload) {
      sockclose pastebin
      did -a PasteBin 25 $+(Status: File uploaded,$crlf,Link:,$crlf,Size: $bytes($file(PasteBin\pb.tmp),b) bytes,$crlf,Number of lines: $did(PasteBin,23).lines,$crlf,Total estimated time: $calc(($ticks - $hget(PasteBin,Ticks))/1000) seconds)
      did -a PasteBin 30 $regml(1) | did -e PasteBin 16,23 | did -cf Pastebin 23 1
      .remove PasteBin\pb.tmp
    }
  }
  elseif ($1) {
    if ($regex(%pb,<title>(.*)\s+pastebin\s+-)) { hadd -m PasteBin Type $regml(1) | did -a PasteBin 25 Status: Buffering $did(PasteBin,19) ... }
    if ($regex(%pb,<h1>(.*)<br/><a href="#")) { hadd -m PasteBin Info $uber($regml(1)) }
    if ($regex(%pb,<div class="de[\d]">(.*)</div>)) || ($regex(%pb,<li class="li[\d]"><div class="de[\d]">(.*)</div>)) {
      hadd -m PasteBin Directory $qt($+(PasteBin\,$iif($2,$+($1,\)),$iif(!$2,$1,$2),$iif(!$2,$+($iif($hget(PasteBin,Type),$+($chr(32),$+($chr(40),$v1,$chr(41)))),$iif($did(PasteBin,20).state,.mrc,.txt)),$iif($did(PasteBin,20).state,.mrc,.txt))))
      var %x $uber($regml(1))
      $iif($hget(PasteBin,Method) == Download,write $hget(PasteBin,Directory) $+($replace(%x,&nbsp;,$iif($count(%x,&nbsp;) != $numtok(%x,32),$chr(32))),$crlf))
      did -a PasteBin 23 $+($replace(%x,&nbsp;,$iif($count(%x,&nbsp;) != $numtok(%x,32),$chr(160))),$crlf)
    }
    if ($regex(%pb,</h1><ul><li>(.*)</li>)) || ($regex(%pb,(.*)<P>)) {
      sockclose pastebin
      did -a PasteBin 25 $+(Status: Ready!,$crlf,Error: Could not download $qt($+(http://,$iif($2,$1),pastebin.com/,$iif($2,$v1,$1))) - $regml(1))
      did -e PasteBin 16,19-23 | did -f PasteBin 23
    }
    if ($regex(%pb,<select name="format">)) {
      sockclose pastebin
      did -e PasteBin 16,19-23 | did -i PasteBin 23 1 | did -d PasteBin 23 1 | did -d PasteBin 23 $did(PasteBin,23).lines
      did -a PasteBin 25 $+(Status: $iif($hget(PasteBin,Method) == Download,$iif($did(PasteBin,20).state,Loaded script $+($chr(35),$script(0),:),Downloaded to:) $hget(PasteBin,Directory),Now previewing),$crlf,Link:,$crlf,PasteBin Type: $iif($hget(PasteBin,Type),$v1,None),$crlf,PasteBin Info: $hget(PasteBin,Info),$crlf,Total estimated time: $calc(($ticks - $hget(PasteBin,Ticks))/1000) seconds)
      did -a PasteBin 30 $did(PasteBin,19) | did -c PasteBin 19 1 | did -cf Pastebin 23 1
      $iif($did(PasteBin,20).state,.load -rs $qt($+($mircdir,$noqt($hget(PasteBin,Directory)))))
    }
  }
}

Comments

  (46)  RSS
Kirby
Comments: 475
 
mIRC Snippet:  Kirby's PasteBin Uploader/Downloader
Posted on May 19, 2009 9:27 pm
Hello. Updates?
I was thinking of "future" updates for this script, but I would like some opinions about this.
Some things that I were thinking about were:
  • PasteBin Upload/Download History
  • Line numbers (like the mIRC editor)
  • PasteBin HELP

I would like some feedback on this. :D
Aucun50
Comments: 548
 
mIRC Snippet:  Kirby's PasteBin Uploader/Downloader
Posted on May 19, 2009 10:51 pm
I see you really took your time doing this and you thought of just about everything, very good job i can't wait to test this out for myself.

This is one other thing you could add, it's not really a need to add but maybe a option to "send to txt" or send the edit box to a txt file that can be saved anywhere.
MaxEvans
Comments: 89
 
mIRC Snippet:  Kirby's PasteBin Uploader/Downloader
Posted on May 19, 2009 11:25 pm
Nice, this will really help out me when I'm working on stuff. I definitely can't wait to test it out! =D
^Neptune
Comments: 598
 
mIRC Snippet:  Kirby's PasteBin Uploader/Downloader
Posted on May 20, 2009 9:51 am
Dialog is WAY too big, it won't even fit on my screen.
WorldDMT
Comments: 171
 
mIRC Snippet:  Kirby's PasteBin Uploader/Downloader
Posted on May 20, 2009 11:52 am
hi

good job but i have some little comments here not a bug but good to know it

about alias pastebin better do this

alias pastebin dialog $iif($dialog(pastebin),-v,-m pastebin) pastebin

cz /dialog -v name and /dialog -m name table

same to "dialog -x PasteBin" only 1 name not 2

about menu dont use "*" put menu query,nicklist,status cz if someone have a game picwin he will get "PasteBin" into the menu game :/ and that is irrelevant

lines 78: did -c PasteBin 10 1 | did -cf PasteBin 23 1

u can do this the focus will be always at the last id "23"
if u put did -cf PasteBin 23,10 1 the focus will be at id 10 here u see?

what that? lines 124 "did -a PasteBin 25 $+(Status: Cleared screen!)" u can remove $+()

line 148 "if ($did == 3) && ($regex($did(3),/[^\w\-]/ig)) { did -ra PasteBin 3 $regsubex($did(3),/([^\w\-])/ig,$null) }"

u can use isin and $remove dont need to use a regex for a smal thing like that

if ($did == 3) && ($chr(32) isin $did(3)) { did -ra $dname 3 $remove($v2,$chr(32)) }

also for $did == 5

if ($did == 5) && ($chr(32) isin $did(5)) || (.. isin $did(5)) did -ra PasteBin 5 $replace($remove($v2,$chr(32)),..,.)

u dont check the error of socket?? and "if ($regex(%pb,<select name="format">))" u can use isin i think
FordLawnmower
Comments: 411
 
mIRC Snippet:  Kirby's PasteBin Uploader/Downloader
Posted on May 20, 2009 1:14 pm
Nice job figuring out that POST. Script looks very nice Kirby.
napa182
Comments: 1,454
 
mIRC Snippet:  Kirby's PasteBin Uploader/Downloader
Posted on May 20, 2009 1:48 pm
Like i told you on the server Kirby. Nice work. ;x

I hate to say this but i agree with Neptune x_x " Looks to see if the sky is falling. " the dialog is abit big, but other then that you get a 9 from me, and a +like ;x

lol @ WorldDMT's Good job but rant...
Kirby
Comments: 475
 
mIRC Snippet:  Kirby's PasteBin Uploader/Downloader
Posted on May 20, 2009 3:05 pm
@ WorldDMT

I see that you are trying to give me helpful suggestions, but I do not agree with some of your suggestions.

Quote:
line 148 "if ($did == 3) && ($regex($did(3),/[^\w\-]/ig)) { did -ra PasteBin 3 $regsubex($did(3),/([^\w\-])/ig,$null) }"

u can use isin and $remove dont need to use a regex for a smal thing like that

if ($did == 3) && ($chr(32) isin $did(3)) { did -ra $dname 3 $remove($v2,$chr(32)) }

In this case, I had to use $regsubex there to remove all non 123-ABC characters, excluding the character '-'. Only '\w' regex strings and - are allowed for PasteBin names. So, I can't really just remove $chr(32)...

Same with:
Quote:
also for $did == 5

if ($did == 5) && ($chr(32) isin $did(5)) || (.. isin $did(5)) did -ra PasteBin 5 $replace($remove($v2,$chr(32)),..,.)

All '\w' characters and, . and -, as exceptions are allowed for sub-domain names. Thus, two subsequent periods are not allowed, but -'s are, which leads to more complication. Furthermore, I had to use many $iif's and some $regsubex there to remove all possible invalid entries.
Simple $remove is not going to help.

As for checking the error of sockets...
Quote:
u dont check the error of socket?? and "if ($regex(%pb,<select name="format">))" u can use isin i think

All that $regex and $regsubex used for the edit boxes try to make the PasteBin paste as "valid" as possible, hence, they are the error checkers.
In fact, about 30% ~ 40% of this snippet is for error checking. The actual script itself can be written in about 100 lines.

Not to mention my code:
Code:
    if ($regex(%pb,</h1><ul><li>(.*)</li>)) || ($regex(%pb,(.*)<P>)) {
checks for invalid links...


But yes, thanks for the other suggestions, I'll take a look into them.



@ ^Neptune

Quote:
Dialog is WAY too big, it won't even fit on my screen.

Well, my screen is only 800 x 600 and it fits fine.
I'll think about compressing the dialog size.
Prelude
Comments: 99
 
mIRC Snippet:  Kirby's PasteBin Uploader/Downloader
Posted on May 20, 2009 3:57 pm
@ KIRBY /run http://pastebin.com/ :)

8/10 for the effort;p
napa182
Comments: 1,454
 
mIRC Snippet:  Kirby's PasteBin Uploader/Downloader
Posted on May 20, 2009 4:00 pm
@ Prelude LMAO
Ayon
Comments: 21
 
mIRC Snippet:  Kirby's PasteBin Uploader/Downloader
Posted on May 21, 2009 5:15 am
great one!

btw why complain about the size? how hard is it to change the size yourself?
^Neptune
Comments: 598
 
mIRC Snippet:  Kirby's PasteBin Uploader/Downloader
Posted on May 21, 2009 9:54 am
You shouldn't have to do that. =/
Ayon
Comments: 21
 
mIRC Snippet:  Kirby's PasteBin Uploader/Downloader
Posted on May 21, 2009 11:37 am
Well what looks good on his screen, might look like shoot on someone elses screen, and the otherway.. i don't mind doing it...
MaxEvans
Comments: 89
 
mIRC Snippet:  Kirby's PasteBin Uploader/Downloader
Posted on May 21, 2009 12:30 pm
Whoa! Kirby, your screen is only 800 x 600? Why you using such a small (but huge) resolution? And my laptop is 1280 x 800, and it doesn't fit entirely. Not sure why though, other than that I love the script.
Prelude
Comments: 99
 
mIRC Snippet:  Kirby's PasteBin Uploader/Downloader
Posted on May 21, 2009 3:04 pm
Quote:

Ayon
Comments: 4

mIRC Snippet: Kirby's PasteBin Uploader/Downloader
Posted on May 21, 2009 5:15 am
great one!

btw why complain about the size? how hard is it to change the size yourself?

^Neptune has a point, we shouldn't have to, and if we DID want to change the fuúckin size ourselves we would have to EDIT MORE THE SIZE OF THE DIALOG, moron....
No one wants to REDO his dialog and all the buttons and edit fields ETC. It should be a general size for atleast MOST of us. @Kirby idgaf if you edit it or not im not using this code anyways, but still good work :)

Anyways try this size ^Neptune:
Code:

dialog pastebin {
  title "Pastebin Uploader / Downloader"
  size -1 -1 454 334
  option dbu
  box "Upload:", 1, 5 3 232 84
  text "Name:", 2, 14 12 16 8
  edit "", 3, 33 11 67 10, autohs center limit 0
  text "Private sub-domain:", 4, 109 12 49 8
  edit "", 5, 160 11 68 10, autohs center limit 0
  text "Syntax highlighting:", 6, 26 26 48 8
  combo 7, 81 25 75 62, size drop
  check "Private Paste?", 8, 171 25 45 10
  button "Browse file...", 9, 11 52 42 12
  edit "", 10, 61 53 170 10, autohs center
  text "How long should your post be retained?", 11, 19 40 96 8
  radio "a day", 12, 126 39 24 10
  radio "a month", 13, 157 39 30 10
  radio "forever", 14, 195 39 28 10
  button "Preview!", 15, 53 69 50 12
  button "Upload!", 16, 135 69 50 12
  box "Download:", 17, 237 3 213 37
  text "Pastebin URL:", 18, 244 11 34 8
  edit "", 19, 280 10 106 10, autohs center
  check "Load to remotes?", 20, 393 10 52 10
  button "Preview", 21, 273 23 50 12
  button "Download!", 22, 362 23 50 12
  edit "", 23, 5 92 443 218, multi return hsbar vsbar
  box "Information:", 24, 237 37 213 50
  text "", 25, 243 44 201 39
  button "Close Dialog", 26, 38 315 60 14
  button "Clear Screen", 27, 142 315 60 14
  button "Copy to Clipboard", 28, 248 315 60 14
  button "Go to line...", 29, 353 315 60 14
  link "", 30, 256 50 188 7
}
Kirby
Comments: 475
 
mIRC Snippet:  Kirby's PasteBin Uploader/Downloader
Posted on May 21, 2009 3:15 pm
One thing I'd like to say about the dialog that I posted - the box about "Information" is designed for that size, so if you compress it, not everything will show up. Of course, the large edit box at the bottom can be compressed horizontally or vertically.
^Neptune
Comments: 598
 
mIRC Snippet:  Kirby's PasteBin Uploader/Downloader
Posted on May 21, 2009 3:42 pm
I suggested Kirby use this:

Code:
dialog pastebin {
  title "Pastebin Uploader / Downloader"
  size -1 -1 386 283
  option dbu
  box "Upload:", 1, 2 0 226 72
  text "Name:", 2, 11 9 16 8
  edit "", 3, 30 8 67 10, autohs center limit 0
  text "Private sub-domain:", 4, 101 10 49 8
  edit "", 5, 152 9 68 10, autohs center limit 0
  text "Highlighting:", 6, 11 22 33 8
  combo 7, 44 20 75 60, size drop
  check "Private Paste?", 8, 122 21 45 10
  button "Browse file...", 9, 184 45 42 11
  edit "", 10, 12 46 170 10, autohs center
  text "How long should your post be retained?", 11, 12 35 96 8
  radio "a day", 12, 110 34 24 10
  radio "a month", 13, 134 34 30 10
  radio "forever", 14, 165 34 28 10
  button "Preview!", 15, 11 57 50 12
  button "Upload!", 16, 63 57 50 12
  box "Download:", 17, 231 0 153 30
  text "Pastebin URL:", 18, 238 7 34 8
  edit "", 19, 274 6 106 10, autohs center
  check "Load to remotes?", 20, 238 17 52 10
  button "Preview", 21, 299 17 40 11
  button "Download!", 22, 340 17 40 11
  edit "", 23, 2 74 382 195, multi return hsbar vsbar
  box "Information:", 24, 231 30 153 42
  text "", 25, 237 37 144 32
  button "Close Dialog", 26, 139 270 60 12
  button "Clear Screen", 27, 201 270 60 12
  button "Copy to Clipboard", 28, 263 270 60 12
  button "Go to line...", 29, 325 270 60 12
  link "", 30, 250 43 125 7
}


Everything works fine and the size is decreased DRAMATICALLY.. but I guess he didn't like it -.-
Prelude
Comments: 99
 
mIRC Snippet:  Kirby's PasteBin Uploader/Downloader
Posted on May 21, 2009 4:40 pm
its cause he hates us ;(
RevJohn Straub
Comments: 46
 
mIRC Snippet:  Kirby's PasteBin Uploader/Downloader
Posted on May 21, 2009 7:17 pm
i think kirby could have done better then this

Firstmate
Comments: 119
 
mIRC Snippet:  Kirby's PasteBin Uploader/Downloader
Posted on May 21, 2009 7:34 pm
Why do you say that Rev?
Blitzjager
Comments: 193
 
mIRC Snippet:  Kirby's PasteBin Uploader/Downloader
Posted on May 21, 2009 7:34 pm
I agree. :P
RevJohn Straub
Comments: 46
 
mIRC Snippet:  Kirby's PasteBin Uploader/Downloader
Posted on May 21, 2009 8:28 pm
this script isnt kirbyish
Ayon
Comments: 21
 
mIRC Snippet:  Kirby's PasteBin Uploader/Downloader
Posted on May 22, 2009 12:16 pm
@Prelude: haha... why redo everything? why not just copy paste the dialog source into an editor? then you wont have to do nothing else than move the items around to fit your liking... or is copy paste to hard for you moron? ;)

Took me about 30 seconds to make it fit my screen more properly than the original :)
MaxEvans
Comments: 89
 
mIRC Snippet:  Kirby's PasteBin Uploader/Downloader
Posted on May 22, 2009 1:48 pm
@Rev I'd like to see you try to make something like this. This is a very helpful script to a lot of us. Including me.
Ayon
Comments: 21
 
mIRC Snippet:  Kirby's PasteBin Uploader/Downloader
Posted on May 22, 2009 2:14 pm
@MaxEvans: x2
ProIcons
Comments: 46
 
mIRC Snippet:  Kirby's PasteBin Uploader/Downloader
Posted on May 22, 2009 2:34 pm
Well maybe i am Crazy:D

10/10
MaxEvans
Comments: 89
 
mIRC Snippet:  Kirby's PasteBin Uploader/Downloader
Posted on May 22, 2009 11:26 pm
Only one thing I would like added to this is a field for your name so you could delete the post like on the site. The rest is really great.
Prelude
Comments: 99
 
mIRC Snippet:  Kirby's PasteBin Uploader/Downloader
Posted on May 22, 2009 11:36 pm
lol@
Quote:

Ayon
Comments: 6

mIRC Snippet: Kirby's PasteBin Uploader/Downloader
Posted on May 22, 2009 12:16 pm
@Prelude: haha... why redo everything? why not just copy paste the dialog source into an editor? then you wont have to do nothing else than move the items around to fit your liking... or is copy paste to hard for you moron? ;)

Took me about 30 seconds to make it fit my screen more properly than the original :)

Actually tosser it took me less then 10 seconds to edit this in DE you fuúckin fag, it WASN'T a comment about ME and my ability to edit this, it was IN GENERAL, for those who would still like to USE this code but DO NOT have a editor, cause frankly NOT all of us use mirc to SCRIPT (or live on IRC like some;))...so for those who DO NOT, it is unlikely they OWN a dialog EDITOR to EDIT so in turn they WOULD have to edit by trial and error;p, which tbh they should NOT have to, gd nerd why dont you scroll the fark UP and see i pasted the fuúcking EDIT in the same comment, for those who DO NOT have a editor for dialogs to COPY AND PASTE, or you can sit at your comp and run your face... you're just another reason stupid ppl should breathe (or breed) you pick ;). Fuúckin IRC kiddies...

Stick to IRC kid, it's about the only thing you may be good at, A+ ;), have a goodin'
Blitzjager
Comments: 193
 
mIRC Snippet:  Kirby's PasteBin Uploader/Downloader
Posted on May 23, 2009 4:45 am
Do the capitalized words make a hidden message?
Ayon
Comments: 21
 
mIRC Snippet:  Kirby's PasteBin Uploader/Downloader
Posted on May 23, 2009 7:33 am
@Prelude: Yeah I'm a nerd :) not afraid to admit that, but hey... you're making scripts as well ;) as long as you do any types of programming you are considered a nerd :) No shame in that.. It's a part of living in 2009 :)

@Blitzjager: Yeah if you re-arrange the words, strip and add some letters it sais "I have nothing else to do, than to sit on hawkee and bash on other peoples comments"
Blubble
Comments: 15
 
mIRC Snippet:  Kirby's PasteBin Uploader/Downloader
Posted on May 23, 2009 10:33 am
Very nice script I must say. 9/10 + like
EDIT: Removed something after reading rest of the comments.
Prelude
Comments: 99
 
mIRC Snippet:  Kirby's PasteBin Uploader/Downloader
Posted on May 23, 2009 8:46 pm
Quote:

Ayon
Comments: 4

mIRC Snippet: Kirby's PasteBin Uploader/Downloader
Posted on May 21, 2009 5:15 am
great one!

btw why complain about the size? how hard is it to change the size yourself?


That was a direct comment to ^Neptune about the size:

Quote:

^Neptune
Comments: 556

mIRC Snippet: Kirby's PasteBin Uploader/Downloader
Posted on May 20, 2009 9:51 am
Dialog is WAY too big, it won't even fit on my screen.


Then you go on to say:
Quote:

@Blitzjager: Yeah if you re-arrange the words, strip and add some letters it sais "I have nothing else to do, than to sit on hawkee and bash on other peoples comments"


So who has nothing better to DO then sit on hawkee and bash other pplz comment?, dumb dumb you where the first to DO it. As for my so called ''bashing'' of your comment LOL hardly what i would consider ''bashing''kid...

Also i ve made constructive comments on here cause i know kirby and he did a good job, it's the ppl like YOU who start dumb %^&! and go on to bash other ppls comments that trigger me to reply, lack of self control...maybe, but you bring it on yourself after all ;).

Also i am not making scripts, i posted 1 pos snippet in god knows how long i've been here, im here to support the REAL scriptors (like kirby), not big mouth lil shiits that just think they are clever, or ppl who post crap and do not take criticism and help, that just post to post and fail at that simple task.

So instead of tryin to go back and forth with me, you could have just said its a good code ETC, even hell threw in a dialog edit of your own... Till the next time kids....
Kirbeh_Pr0nz
Comments: 144
 
mIRC Snippet:  Kirby's PasteBin Uploader/Downloader
Posted on May 23, 2009 9:12 pm
I love it! *cough*alittletoobig*cough* but i love it.
one fault i found=> when ever i tried to enter pastebin url, it wouldnt wirk, i think due to the fact that it only accepts "http://blahblah.pastebin.com/blah" format. yet, some urls have "http://pastebin.blahblah.com/blah" format, which the snippet wont read.
is there anything i need to do to get it to work?
^Neptune
Comments: 598
 
mIRC Snippet:  Kirby's PasteBin Uploader/Downloader
Posted on May 24, 2009 8:54 am
Ayon, shut the fύck up.
Kirby
Comments: 475
 
mIRC Snippet:  Kirby's PasteBin Uploader/Downloader
Posted on May 24, 2009 9:50 am
@Kirbeh_Pr0nz
The reason why
Code:
http://pastebin.blahblah.com/blah
doesn't work is because that would mean that "blahblah.com" would be the domain, and not "pastebin.com".
Ayon
Comments: 21
 
mIRC Snippet:  Kirby's PasteBin Uploader/Downloader
Posted on May 24, 2009 10:02 am
:)
Kirby
Comments: 475
 
mIRC Snippet:  Kirby's PasteBin Uploader/Downloader
Posted on May 27, 2009 1:31 pm
WorldDMT said:
Quote:
u can use isin and $remove dont need to use a regex for a smal thing like that
Although this controversy is quite over, I'd also like to add the reason why I prefer using $regex in my sockread is because not only do I use it for detection, it's easier for me to make the use of a single $regml(N) than using many $gettok and $htmlfree.
Kirbeh_Pr0nz
Comments: 144
 
mIRC Snippet:  Kirby's PasteBin Uploader/Downloader
Posted on May 28, 2009 5:36 pm
Im not good with dialogs, is there a way to make it vertically smaller? i cant see the bottom buttons. o_o;
MaxEvans
Comments: 89
 
mIRC Snippet:  Kirby's PasteBin Uploader/Downloader
Posted on May 28, 2009 5:42 pm
Neptune^ posted this, and it works really well. I had the same problem, I have a widescreen resolution and I couldn't see the bottom buttons. But this one fixes it. Here's the code again.

Code:
dialog pastebin {
  title "Pastebin Uploader / Downloader"
  size -1 -1 386 283
  option dbu
  box "Upload:", 1, 2 0 226 72
  text "Name:", 2, 11 9 16 8
  edit "", 3, 30 8 67 10, autohs center limit 0
  text "Private sub-domain:", 4, 101 10 49 8
  edit "", 5, 152 9 68 10, autohs center limit 0
  text "Highlighting:", 6, 11 22 33 8
  combo 7, 44 20 75 60, size drop
  check "Private Paste?", 8, 122 21 45 10
  button "Browse file...", 9, 184 45 42 11
  edit "", 10, 12 46 170 10, autohs center
  text "How long should your post be retained?", 11, 12 35 96 8
  radio "a day", 12, 110 34 24 10
  radio "a month", 13, 134 34 30 10
  radio "forever", 14, 165 34 28 10
  button "Preview!", 15, 11 57 50 12
  button "Upload!", 16, 63 57 50 12
  box "Download:", 17, 231 0 153 30
  text "Pastebin URL:", 18, 238 7 34 8
  edit "", 19, 274 6 106 10, autohs center
  check "Load to remotes?", 20, 238 17 52 10
  button "Preview", 21, 299 17 40 11
  button "Download!", 22, 340 17 40 11
  edit "", 23, 2 74 382 195, multi return hsbar vsbar
  box "Information:", 24, 231 30 153 42
  text "", 25, 237 37 144 32
  button "Close Dialog", 26, 139 270 60 12
  button "Clear Screen", 27, 201 270 60 12
  button "Copy to Clipboard", 28, 263 270 60 12
  button "Go to line...", 29, 325 270 60 12
  link "", 30, 250 43 125 7
}
Kirbeh_Pr0nz
Comments: 144
 
mIRC Snippet:  Kirby's PasteBin Uploader/Downloader
Posted on May 28, 2009 5:46 pm
ooooh ok thx
Kirbeh_Pr0nz
Comments: 144
 
mIRC Snippet:  Kirby's PasteBin Uploader/Downloader
Posted on May 28, 2009 5:47 pm
wait.....still too big :P
SudsyUncle
Comments: 9
 
mIRC Snippet:  Kirby's PasteBin Uploader/Downloader
Posted on May 28, 2009 5:52 pm
for those with mini screens:
Code:

dialog pastebin {
  title "Pastebin Uploader / Downloader"
  size -1 -1 454 204
  option dbu
  box "Upload:", 1, 5 2 232 84
  text "Name:", 2, 14 11 16 8
  edit "", 3, 33 10 67 10, autohs limit 24 center
  text "Private sub-domain:", 4, 109 11 49 8
  edit "", 5, 160 10 68 10, autohs limit 50 center
  text "Syntax highlighting:", 6, 26 25 48 8
  combo 7, 81 24 75 62, sort size drop
  check "Private Paste?", 8, 171 24 45 10
  button "Browse file...", 9, 11 51 42 12
  edit "", 10, 61 52 170 10, autohs center
  text "How long should your post be retained?", 11, 19 39 96 8
  radio "a day", 12, 126 38 24 10
  radio "a month", 13, 157 38 30 10
  radio "forever", 14, 195 38 28 10
  button "Preview!", 15, 53 68 50 12
  button "Upload!", 16, 135 68 50 12
  box "Download:", 17, 237 2 213 37
  text "Pastebin URL:", 18, 244 10 34 8
  edit "", 19, 280 9 106 10, autohs center
  check "Load to remotes?", 20, 393 9 52 10
  button "Preview", 21, 273 22 50 12
  button "Download!", 22, 362 22 50 12
  edit "", 23, 5 90 443 91, multi return hsbar vsbar
  box "Information:", 24, 237 36 213 50
  text "", 25, 243 43 201 39
  button "Close Dialog", 26, 44 187 60 14
  button "Clear Screen", 27, 148 187 60 14
  button "Copy to Clipboard", 28, 254 187 60 14
  button "Go to line...", 29, 359 187 60 14
  link "", 30, 256 49 188 7
}

iCub
Comments: 25
 
mIRC Snippet:  Kirby's PasteBin Uploader/Downloader
Posted on May 28, 2009 5:59 pm
<insert comment on script> && <insert witty remarks at bashers>
10/10
P.S- Needs more porn
Kirbeh_Pr0nz
Comments: 144
 
mIRC Snippet:  Kirby's PasteBin Uploader/Downloader
Posted on May 28, 2009 6:18 pm
*cough*too wide*cough* x3
SudsyUncle
Comments: 9
 
mIRC Snippet:  Kirby's PasteBin Uploader/Downloader
Posted on May 28, 2009 6:20 pm
/me is too lazy to edit for width
sixkilur
Comments: 1
 
mIRC Snippet:  Kirby's PasteBin Uploader/Downloader
Posted on Sep 22, 2009 9:47 am
* /did: invalid parameters (line 201, pastebin3.mrc)

* /did: invalid parameters (line 201, pastebin3.mrc)
-
* /did: invalid parameters (line 201, pastebin3.mrc)
-
* /did: invalid parameters (line 201, pastebin3.mrc)
-
* /did: invalid parameters (line 201, pastebin3.mrc)
-
* /did: invalid parameters (line 201, pastebin3.mrc)
wich would be this line
Code:
did -a PasteBin 25 $+(Status: Downloaded text files,$crlf,Total estimated time: $calc(($ticks - $hget(PasteBin,Ticks))/1000) seconds)


does that 72 times the abbrev.txt creation i think
i was able to change the line 209
did -a to did -f and it seems to be working good now. nice script
could use some work.


Commenting Options

Register or Login to Hawkee.com or use your Facebook or Twitter account by clicking the corresponding button below.

  
Bottom