With this add-on you can use http://paste.prco23.org/ within mIRC. I tend never to leave my browser window open if I'm not using it, so every time I wanted to paste something I had to wait several seconds for it to start up. Here you get a /paste alias that opens a dialog allowing you to submit pastes without ever leaving mIRC. It allows you to get the content from your clipboard, from a file, or just enter it into the edit field.
And have no fears, with the help of a genuine mIRC expert, I was able to make it preserve spaces even though mIRC is known to handle that poorly.
mIRC v6.20 (or above) — Uses the $regsubex identifier to overcome the space-preserving issue. This identifier was introduced in 6.17, but did not preserve spaces until 6.20.
| Date | Version | Download |
|---|---|---|
| 2007-02-05 | 0.7 | .zip (5.4kb) |
| 2007-02-05 | 0.6 | .zip (5.1kb) |
| 2007-01-04 | 0.5 | .zip (3.4kb) |
/paste [-cookie|-cb|-go]
If you later wish to find/delete the paste again through your browser, you should consider using the same cookie as you do in your browser, assuming you have already pasted regularly with it. Instructions on how to find/save this cookie in the three most common browsers can be found on the Find Cookie page.
The -cb switch will load the content of your clipboard in to the dialog.
The -go switch will load the content of your clipboard in to the dialog and submit it.
* /sockwrite: 'paste' queue would exceed 16384 bytes (line 560, paste.mrc)
In the future I might redesign how I submit the data to paste.prco23.org, and spread out the code over multiple sockwrite's to avoid filling up the outgoing buffer/queue to allow bigger pastes.
; ; @name Paste - Use paste.prco23.org within mIRC ; @version 0.7 (2007-02-05) ; @licence GPL 2 ; @author David Lorentsen <zyberdog@quakenet.org> ; @www http://wiki.zyberdog.dk/mirc/paste ; alias paste { if ($1 == -cookie) { if ($len($2) == 32) { set %paste.cookie $2 e Cookie set to: $2 } else { dialog -m paste.cookie paste.cookie } } elseif ($1 == -help) { e /paste [-cookie [cookie]|-help|-cb|-go] e With the -cookie parameter you can set the cookie used when pasting. e By not including a cookie with the -cookie parameter you are given the 'Cookie Setup' dialog, with search functionality. e For information and updates, see http://wiki.zyberdog.dk/mirc/paste } else { if ($dialog(paste)) { dialog -v paste if ($1 == -cb) { paste.importcb } elseif ($1 == -go) { paste.submit } } else { dialog -dm paste paste if ($1 == -cb) { paste.importcb } elseif ($1 == -go) { paste.submit } } } } alias -l e { echo -aci9 Info $+($chr(2),[paste],$chr(2)) $1- } alias -l v { return 0.7 } alias loadingbar { if (!$dialog(paste)) { .timerpaste off } elseif ($1 == stop) { .timerpaste off did -e paste 9,10,11 } elseif ($1 == start) { did -r paste 2 did -b paste 8,9,10,11 .timerpaste -m 0 100 loadingbar } else { var %o = $mid($did(paste,2),2,14) if (!$len(%o)) { sbu [~----~--------] } else { sbu $chr(91) $+ $right(%o,1) $+ $left(%o,13) $+ $chr(93) } } } alias -l sbu { did -ra paste 2 $1- } alias -l types { var %types = mIRC:mirc bash:bash C:c C++:cpp CSS:css diff:diff HTML:html $& Java:java Javascript:javascript LUA:lua MySQL:mysql Perl:perl PHP:php $& Python:python Ruby:ruby SQL:sql TCL:tcl Text:text XML:xml if (!$1) { return %types } elseif ($1 isnum) { return $gettok($gettok(%types,$1,32),2,58) } } alias -l searchpath { .comopen e WScript.Shell var %x = $com(e,ExpandEnvironmentStrings,3,bstr,% $+ $1 $+ %) var %x = $com(e).result .comclose e return %x } alias -l findcookie { if ($1 == firefox) { var %p = $searchpath(APPDATA) var %m = $findfile(%p,cookies.txt,0) while (%m) { var %f = $findfile(%p,cookies.txt,%m) if (Mozilla\Firefox\Profiles isin %f) { var %key = $gettok($read(%f,w,paste.prco23.org*key*),-1,9) return %key break } dec %m } } elseif ($1 == ie) { var %p = $searchpath(USERPROFILE) $+ \Cookies\ var %f = $findfile(%p,*paste.prco23*,1) var %n = $read(%f,w,key) var %key = $read(%f,$calc($readn +1)) return %key } elseif ($1 == opera) { ; quite difficult due to opera's binary structured cookie file. ; use the guide instead. } return 0 } alias -l parse { write -c paste.txt did -b paste.parse 3 did -r paste.parse 4 var %indent = 0, %nindent = 0, %nogo = 0, %leftcont = 0, %rightcont = 0 var %line.num = 1 var %lines = $did(paste,12).lines while (%line.num <= %lines) { if (!$dialog(paste.parse)) { return } if (%paste.parse.cancel) { did -ra paste.parse 4 Cancelled... return } did -ra paste.parse 8 %line.num $+ / $+ %lines var %line = $did(paste,12,%line.num) var %garbage = $regsub(%line,^[ ]+|[ ]+$,,%tline) var %tline.len = $len(%tline), %n = 1 while (%n <= %tline.len) { did -ra paste.parse 9 %n $+ / $+ %tline.len var %cc = $mid(%tline,%n,1) var %lc = $iif(%n > 1,$mid(%tline,$calc(%n -1),1),$null) var %nc = $iif(%tline.len != %n,$mid(%tline,$calc(%n +1),1),$null) ; Check for commented sections/lines if (%cc == /) && (%nc == *) { var %nogo = 2 } elseif (%cc == *) && (%nc == /) { var %nogo = 0 } elseif (%lc == $chr(32) || !%lc) && (%cc == ;) && (%nogo != 2) { var %nogo = 1 } elseif (%nogo != 2) { %nogo = 0 } if (!%nogo) { if ((%lc == $chr(32) || %lc == $null || %lc == $chr(58)) && (%nc == $chr(32) || %tline.len == %n)) { if (%cc == $chr(123)) { inc %indent 2 } elseif (%cc == $chr(125)) { if (%indent > 0) { dec %indent 2 } else { var %key = %lastchapter_line if (!$istok(%paste.parse.errors,%key,32)) { set %paste.parse.errors $addtok(%paste.parse.errors,%key,32) parse.error Curly bracket error in the event/alias starting on line %lastchapter_line $+ :\n $& %lastchapter_text $+ \n $& More closing curly brackets, $chr(125) $+ , than opening. } } } } } inc %n } if (!%nogo) { ; Check for new chapter starts if ($regex(%tline, /^(((alias|dialog)( -l)?|menu) \S+ {.*|on \S+:\w+:.*|raw \S+:.+:.*|ctcp \S+:.+:\S+:.*|#\w+ (on|off|end))$/i)) { if (%nindent > 0) { var %key = %lastchapter_line if (!$istok(%paste.parse.errors,%key,32)) { set %paste.parse.errors $addtok(%paste.parse.errors,%key,32) parse.error Curly bracket error in the event/alias starting on line %lastchapter_line $+ :\n $& %lastchapter_text $+ \n $& More opening curly brackets, $chr(123) $+ , than closing. } } else { var %lastchapter_line = %line.num var %lastchapter_text = %tline } } if ($right(%tline,3) == $+($chr(32),$,&)) { if (%linecont == 0) { inc %indent 2 } var %linecont = 1 } else { if (%linecont == 1) { dec %indent 2 if (%leftcont != %rightcont) { var %key = %contstart if (!$istok(%paste.parse.errors,%key,32)) { set %paste.parse.errors $addtok(%paste.parse.errors,%key,32) parse.error Parenthesis warning on lines %contstart to %n $+ :\n $& There $iif(%leftcont > 1,are,is) $iif(%leftcont < %rightcont,only $+ $chr(32)) $+ %leftcont $chr(40) $+ , but $iif(%leftcont > %rightcont,only $+ $chr(32)) $+ %rightcont $chr(40) $+ . } var %leftcont = 0, %rightcont = 0 } var %linecont = 0 } } var %left = $count(%tline,$chr(40)), %right = $count(%tline,$chr(41)) if (%linecont == 1) { var %contstart = %line.num inc %leftcont %left inc %rightcont %right } elseif (%left != %right) { var %key = %line.num $+ s if (!$istok(%paste.parse.errors,%key,32)) { set %paste.parse.errors $addtok(%paste.parse.errors,%key,32) parse.error Parenthesis warning on line %line.num $+ :\n $& %tline $+ \n $& There $iif(%left > 1,are,is) $iif(%left < %right,only $+ $chr(32)) $+ %left $chr(40) $+ , but $iif(%left > %right,only $+ $chr(32)) $+ %right $chr(41) $+ . } } var %lefts = $count(%tline,$chr(91)), %rights = $count(%tline,$chr(93)) if (%lefts != %rights) { var %key = %line.num $+ ss if (!$istok(%paste.parse.errors,%key,32)) { set %paste.parse.errors $addtok(%paste.parse.errors,%key,32) parse.error Square brackets warning on line %line.num $+ :\n $& %tline $+ \n $& There is $iif(%lefts < %rights,only $+ $chr(32)) $+ %lefts $chr(91) $+ , but $iif(%lefts > %rights,only $+ $chr(32)) $+ %rights $chr(93) $+ . } } } if ($len(%tline)) { bset &tmp 1 $str($+(32,$chr(32)),$iif(%cc == $chr(125),%indent,%nindent)) $+ $regsubex(%tline,/(.)/g,$asc(\t) $+ $chr(32)) $iif(%lines != %line.num,13 10) bwrite paste.txt -1 -1 &tmp bunset &tmp } elseif (%lines != %line.num) { bset &tmp 1 13 10 bwrite paste.txt -1 -1 &tmp bunset &tmp } var %p = $ceil($calc(%line.num / %lines * 100)) var %b = $ceil($calc(%p / 100 * 69)) did -ra paste.parse 7 $str(|,%b) %p $+ % var %nindent = %indent inc %line.num } if (%nindent > 0) { var %key = %lastchapter_line if (!$istok(%paste.parse.errors,%key,32)) { set %paste.parse.errors $addtok(%paste.parse.errors,%key,32) parse.error Curly bracket error in the event/alias starting on line %lastchapter_line $+ :\n $& %lastchapter_text $+ \n $& More opening curly brackets, $chr(123) $+ , than closing. } } if (!%paste.parse.errors) { did -a paste.parse 4 The parser did not find any curly/square bracket or parenthese mis-matches in code. dialog -c paste.parse } :error if ($gettok($error,2-4,32) == Break: command halted) { did -a paste.parse 4 Parsing cancelled... var %noupd = 1 } if (!%noupd) { did -r paste 12 loadbuf -o paste 12 paste.txt } if ($dialog(paste.parse)) { did -e paste.parse 3 } .remove paste.txt } alias -l parse.error { did -a paste.parse 4 $+($replace($1-,\n,$crlf),$crlf,--------------------,$crlf) } alias -l paste.importcb { if ($cb(0)) { did -e paste 8 did -r paste 12 write -c paste.tmp var %x = 1, %y = $cb(0) while (%x <= %y) { if ($cb(%x)) { bset &tmp 1 $regsubex($cb(%x),/(.)/g,$asc(\t) $+ $chr(32)) $iif(%x != %y,13 10) bwrite paste.tmp -1 -1 &tmp bunset &tmp } inc %x } loadbuf -o paste 12 paste.tmp sbu Click 'Paste!' when you want to submit. .remove paste.tmp } } alias -l paste.submit { paste.importcb loadingbar start if ($sock(paste)) { sockclose paste } set %paste.submit 1 sockopen paste paste.prco23.org 80 } dialog paste { title "paste.prco23.org [/paste]" size -1 -1 600 500 option pixels notheme text "Nick:", 6, 8 12 24 16 text "Type:", 7, 136 12 28 16 edit "Enter paste above.", 2, 8 474 438 20, read center edit "", 3, 32 8 100 22, limit 0 edit "", 12, 4 75 593 392, autohs autovs multi return hsbar vsbar limit 0 combo 4, 166 8 82 70, drop edit "", 14, 4 36 593 35, autovs multi return vsbar limit 0 check "Default", 5, 254 10 58 20 button "&Close", 1, 527 472 64 24, ok button "&Paste!", 8, 456 472 64 24 button "&Trim", 15, 344 5 35 24 button "Clip&board", 9, 387 5 62 24 button "&File", 10, 458 5 62 24 button "Cle&ar", 11, 529 5 62 24 button "{ }", 13, 315 5 22 24, hide } dialog paste.cookie { title "Cookie Setup [/paste -cookie]" size -1 -1 256 186 option pixels notheme button "&Close", 4, 134 156 64 24, cancel button "&Save", 5, 56 156 64 24, ok box "Attempt to find from browser", 1, 6 4 244 58 button "Mozilla Firefox", 2, 22 26 100 24 button "Internet Explorer", 3, 134 26 100 24 edit "", 8, 8 130 238 20, center limit 0 text "If you are using Opera or if button of your browser above fails to find your cookie, you will have to do it manually. Instructions here:", 9, 12 64 230 40 link "http://wiki.zyberdog.dk/mirc/paste/cookie", 7, 26 106 206 16 } dialog paste.parse { title "paste.prco23.org - parser" size -1 -1 360 293 option pixels notheme box "Status", 1, 5 3 350 68 box "Results", 2, 5 74 350 180 button "Close", 3, 148 263 65 25 edit "", 4, 16 94 330 151, read autovs multi return vsbar text "Line:", 5, 43 24 34 17, right text "Character:", 6, 183 24 60 17, right text "0%", 7, 20 46 320 17 text "0/0", 8, 82 24 70 17 text "0/0", 9, 248 24 70 17 } on *:DIALOG:paste.cookie:init:*:{ if (%paste.cookie) { did -ra $dname 8 %paste.cookie } } on *:DIALOG:paste:init:*:{ if (%paste.nick) { did -ra $dname 3 $v1 did -f $dname 12 } else { did -f $dname 3 } var %types = $types, %x = 1, %y = $numtok(%types,32) while (%x <= %y) { did -a $dname 4 $gettok($gettok(%types,%x,32),1,58) inc %x } if (%paste.type) { did -c $dname 4 %paste.type did -c $dname 5 if (%paste.type == 1) { did -v $dname 13 } } else { set %paste.type 18 did -c $dname 4 %paste.type did -c $dname 5 } did -b $dname 8 } on *:DIALOG:paste.parse:init:*:{ .timer -m 1 100 parse } on *:DIALOG:paste.parse:sclick:*:{ if ($did == 3) { dialog -c $dname } } on *:DIALOG:paste.parse:close:*:{ unset %paste.parse.* } on *:DIALOG:paste:edit:*:{ if ($did == 3) { set %paste.nick $did($dname,3).text } elseif ($did == 12) { if (!$did($dname,8).enabled) { did -e $dname 8 sbu Click 'Paste!' when you want to submit. } elseif ($did($dname,12).lines == 1 && $did($dname,12,1).len == 0) { did -b $dname 8 sbu Enter paste above. } } } on *:DIALOG:paste:sclick:*:{ if ($did == 1) { ; 'Close' button ; Don't do anything here. Using close event below instead. } elseif ($did == 8) { ; 'Paste!' button loadingbar start if ($sock(paste)) { sockclose paste } sockopen paste paste.prco23.org 80 } elseif ($did == 9) { ; 'Clipboard' button paste.importcb } elseif ($did == 10) { ; 'File' button var %file = $sfile($mircdir,Select source for paste,Select) if (%file) { if ($file(%file).size < 16384) { did -e $dname 8 did -r $dname 12 loadbuf -o $dname 12 %file sbu Click 'Paste!' when you want to submit. } else { sbu Error. File is too big. Limit is 16384 bytes. } } else { did -f $dname 12 } } elseif ($did == 11) { ; 'Clear' button did -rf $dname 12 did -b $dname 8 sbu Enter paste above. } elseif ($did == 4) { ; 'Type' dropdown if ($did($dname,4).sel == %paste.type) { did -c $dname 5 } else { did -u $dname 5 } if ($did($dname,4).sel == 1) { did -v $dname 13 } else { did -h $dname 13 } } elseif ($did == 13) { ; {} button dialog -amdo paste.parse paste.parse } elseif ($did == 15) { ; Trim button ; For now, let's just trim out the first 2 spaceseperated tokens write -c paste.tmp var %x = 1, %y = $did($dname,12).lines, %z, %trim = $input(How many tokens should be trimmed? (between 1 and 6),qeuo,Trim,2) if (!%trim) { halt } elseif (%trim < 1) || (%trim > 6) { var %trim = 2 } var %trim = $str(\S+\s,%trim) while (%x <= %y) { var %z = $regsubex($did($dname,12,%x).text,/^ $+ %trim $+ (.*)$/,\1) if (!%z) { var %z = $crlf } bset &tmp1 1 $regsubex(%z,/(.)/g,$asc(\t) $+ $chr(32)) $iif(%x != %y,13 10) bwrite paste.tmp -1 -1 &tmp1 bunset &tmp1 inc %x } did -r $dname 12 loadbuf -o paste 12 paste.tmp .remove paste.tmp bunset &tmp1 } elseif ($did == 5) { ; 'Default' checkbox if ($did($dname,5).state == 1) { set %paste.type $did($dname,4).sel } else { set %paste.type 18 } } } on *:DIALOG:paste.cookie:sclick:*:{ if ($did == 2) { did -b $dname 2,3,4,5 did -ra $dname 2 Searching... var %c = $findcookie(firefox) if (%c) { did -ra $dname 8 %c } did -ra $dname 2 Mozilla Firefox did -e $dname 2,3,4,5 } elseif ($did == 3) { did -b $dname 2,3,4,5 did -ra $dname 3 Searching... var %c = $findcookie(ie) if (%c) { did -ra $dname 8 %c } did -ra $dname 3 Internet Explorer did -e $dname 2,3,4,5 } elseif ($did == 5) { set %paste.cookie $did($dname,8) } } on *:DIALOG:paste:close:*:{ if ($timer(paste)) { .timerpaste off } if ($sock(paste)) { sockclose paste } } on *:SOCKOPEN:paste:{ var %nick = $did(paste,3).text var %type = $types($did(paste,4).sel) var %desc var %x = 1, %y = $did(paste,14).lines while (%x <= %y) { var %desc = $+(%desc,$did(paste,14,%x).text,$iif(%x != %y,$crlf)) inc %x } var %query = $+(nick=,%nick,&type=,%type,&desc=,%desc,&data=) bset &tmp1 1 $regsubex(%query,/(.)/g,$asc(\t) $+ $chr(32)) write -c paste.tmp bwrite paste.tmp 1 -1 &tmp1 sockwrite -n $sockname POST / HTTP/1.1 sockwrite -n $sockname Host: paste.prco23.org sockwrite -n $sockname User-Agent: mIRC/ $+ $version $nopath($script) $+ / $+ $v sockwrite -n $sockname Connection: keep-alive sockwrite -n $sockname Cookie: $iif(%paste.cookie,$+(key=,%paste.cookie,; )) $+ $+(nick=,%nick) sockwrite -n $sockname Content-Type: application/x-www-form-urlencoded var %x = 1, %y = $did(paste,12).lines, %z while (%x <= %y) { var %z = $replacex($did(paste,12,%x),&,$+(%,26),+,$+(%,2B),%,$+(%,25)) bset &tmp2 1 $regsubex(%z,/(.)/g,$asc(\t) $+ $chr(32)) 13 10 bwrite paste.tmp -1 -1 &tmp2 bunset &tmp2 inc %x } sockwrite -n $sockname Content-Length: $file(paste.tmp).size sockwrite -n $sockname bread paste.tmp 1 $file(paste.tmp).size &tmp3 sockwrite $sockname &tmp3 .remove paste.tmp bunset &tmp1 &tmp2 &tmp3 &tmp4 &tmp5 sockwrite $sockname $crlf } on *:SOCKREAD:paste:{ if ($sockerr > 0) { e Socket error: $sockerr | return } var %temp sockread %temp if ($dialog(paste)) { if ($regex(%temp, /<h3><a href="/(\d+)">http://paste\.prco23\.org/\d+</a></h3>/)) { clipboard http://paste.prco23.org/ $+ $regml(1) loadingbar stop sbu Success. http://paste.prco23.org/ $+ $regml(1) copied to clipboard. sockclose $sockname if (%paste.submit) { unset %paste.submit dialog -c paste e Success. http://paste.prco23.org/ $+ $regml(1) copied to clipboard. } } elseif ($regex(%temp, /<h2>(Error.+?)</h2><h3>(.+?)</h3>/)) { loadingbar stop sbu $regml(1) sockclose $sockname if (%paste.submit) { unset %paste.submit dialog -c paste e $regml(1) } } } } on *:LOAD:{ if ($version < 6.20) { e You need atleast mIRC v6.20 to use this add-on. You are running $+(v,$version,.) e Get a newer version of mIRC on http://www.mirc.co.uk/ unload -nrs $+(",$script,") } else { e You can open the paste dialog with: /paste e Remember to set a cookie if you already have one before starting to paste. e You can do that in the 'Cookie Setup' dialog, /paste -cookie e Need instructions on how to find it? See http://wiki.zyberdog.dk/mirc/paste/cookie } } on *:UNLOAD:{ unset %paste.nick %paste.type %paste.cookie }
-go switch to paste clipboard content.-cb switch to fill the dialog with clipboard content.{ } button to parse the code for any {[()]} errors + indent it.+ and %.& characters in paste.