Simply uploads to your choice of paste.stirk.org or pastebin.com (i normally only use paste.stirk.org but i believe pastebin.com supports bigger posts?)
heres the main dialog
other features include pastebin downloader to view your saved pastes
and edit your settings in a seperate dialog
; I used brackets everywhere cuz i think its neater for giant codes
dialog paste {
title "Pastebin uploader V0.3"
size -1 -1 359 240
option dbu
edit "", 1, 3 2 353 183, multi return autovs vsbar
text "Description:", 2, 5 199 32 8
edit "", 3, 42 198 82 10, autohs
text "Author:", 4, 5 212 25 8
edit "", 5, 42 211 82 10, autohs
combo 6, 42 225 82 11, drop
text "Highlighting:", 7, 5 226 32 8
check "Password protected", 8, 131 211 61 10
edit "", 9, 130 225 67 10, disable
check "Save URL automatically", 10, 131 198 69 10
button "&Upload", 11, 206 199 41 11
button "&Close", 12, 310 199 41 11
button "&Saved URLs", 13, 258 199 41 11
text "URL:", 14, 209 221 15 8
edit "", 15, 228 220 84 10, read autohs
button "&Clpb", 16, 320 220 29 9
text "Bytes:", 17, 5 187 19 8
text "0", 18, 31 187 33 8, right
text "Lines:", 19, 81 187 17 8
text "0", 20, 106 187 35 8, right
text "Status:", 21, 156 187 19 8
text "Ready", 22, 190 187 161 8, right
menu "File", 23
item "Save draft", 24, 23
item "Load draft", 25, 23
item "Delete drafts...", 31, 23
item break, 33, 23
item "Saved URLs", 35, 23
item break, 36, 23
item "Exit", 26, 23, cancel
menu "Edit", 27
item "Clear text", 32, 27
item "Clipboard text", 28, 27
item "Load from clipboard", 29, 27
item break, 34, 27
item "Edit settings", 30, 27
}
dialog saved {
title "Saved URLS"
size -1 -1 359 212
option dbu
list 1, 3 2 101 197, size
edit "", 5, 108 2 248 197, read multi autovs vsbar
button "+ URL", 2, 5 200 30 10
button "- URL", 3, 38 200 30 10
button "Close", 4, 71 200 30 10, cancel
text "URL:", 6, 112 201 17 8
edit "", 7, 136 200 84 10, read autohs
button "Clpb", 8, 222 201 18 9
button "Clpb content", 9, 311 201 44 9
text "", 10, 245 201 63 8, center
}
dialog psettings {
title "Pastebin settings"
size -1 -1 191 186
option dbu
box "Defaults", 1, 4 1 183 83
text "Description:", 2, 9 10 30 8
radio "None", 3, 43 9 27 10, group
radio "Other", 4, 70 9 25 10
edit "", 5, 96 9 85 10, disable
text "Author:", 6, 9 25 21 8
radio "None", 7, 43 24 25 10, group
radio "Other", 8, 70 24 26 10
edit "", 9, 96 24 85 10, disable
text "Highlighting:", 10, 9 56 31 8
combo 12, 61 54 120 11, drop
check "Save URL automatically", 11, 9 70 69 10
text "Password:", 13, 9 40 25 8
radio "None", 14, 43 39 25 10, group
radio "PW", 15, 70 39 24 10
edit "", 16, 96 39 85 10, disable
box "Other settings", 17, 4 132 183 36
text "Update content counter every", 18, 9 142 74 8
edit "", 19, 84 141 16 10
text "seconds", 20, 102 142 25 8
check "Prompt when deleting saved URLs / drafts", 21, 9 155 116 10
button "&Done", 22, 14 172 75 10
button "&Cancel", 23, 101 172 75 10, cancel
box "Pastebin", 24, 4 84 183 48
radio "Paste.stirk.org", 25, 9 94 49 10, group
radio "Pastebin.com", 26, 9 106 44 10
text "Keep paste retained for", 27, 9 118 60 8
combo 28, 78 116 102 11, disable drop
}
alias paste {
if (!$isdir(pastebin)) {
mkdir pastebin
hmake paste
hmake pset
tokenize 126 description~author~password~highlighting 1~SaveURL 1~count 1~prompt 1~pastebin 1~expiry f~sw -m
hadd pset $*
}
if ($dialog(paste)) { dialog -v paste }
else {
hadd pset sw $iif(-?* iswm $1,$1,-m)
dialog $hget(pset,sw) paste paste
}
}
alias paste.lines {
var %line 1, %bytes
while (%line <= $did(paste,1).lines) {
inc %bytes $len($did(paste,1,%line))
inc %line
}
did -ra paste 18 %bytes
did -ra paste 20 $iif($did(paste,1) == $null,0,$calc(%line - 1))
}
alias paste.hl {
var %x $2-
if ($1 == 1) {
tokenize 32 None applescript asp bash c csharp css delphi html4script java java5 javascript lisp mirc mysql objc oracle8 perl php $&
plsql python ruby sql tcl vb vbnet xml
}
else {
tokenize 126 None~ABAP~ActionScript~Ada~AppleScript~ASP~AutoIt~Bash~ $+ $&
BNF~C~C++~C#~ColdFusion~CSS~D~Delphi~Diff~DOS~Eiffel~Fortran~ $+ $&
FreeBasic~Genero~Groovy~Haskell~HTML~IDL~INI~Java~Javascript~Latex~Lisp~ $+ $&
Lua~MatLab~MPASM~mIRC~MySQL~OCaml~Pascal~Perl~PHP~PL/SQL~ $+ $&
Python~Rails~Robots~Ruby~Scheme~Smalltalk~Smarty~SQL~TCL~VisualBasic~VB.NET~VisualFoxPro~XML
}
did -a %x $*
}
alias html {
var %x $regsubex($1-,/(^[^<]*>|<[^>]*>|<[^>]*$)|x09/g,$null)
%x = $regsubex(%x,/&x23(d+);/g,$chr(1))
if ($regex(%x,/&w+;/)) {
%x = $replace(%x,",",',',&,&,<,<,>,>, $+ $&
, ,¥,¥,©,©,«,«,•,•,‹,‹,›,›)
}
return %x
}
alias urlenc { return $regsubex($1-,/(W|s)/g,$chr(37) $+ $base($asc(1),10,16,2)) }
on *:start:{
hmake paste
hload paste pastebinpaste.dat
hmake pset
hload pset pastebinpset.dat
}
on *:exit:{
hsave paste pastebinpaste.dat
hsave pset pastebinpset.dat
}
menu * {
Pastebin:{ paste }
}
on *:dialog:paste:*:*:{
if ($devent == init) {
did -a $dname 3 $hget(pset,description)
did -a $dname 5 $hget(pset,author)
paste.hl $hget(pset,pastebin) $dname 6
did -c $dname 6 $hget(pset,highlighting)
if ($hget(pset,SaveURL)) { did -c $dname 10 }
if ($hget(pset,password)) {
did -c $dname 8
did -ea $dname 9 $v1
}
.timerpaste 0 $hget(pset,count) paste.lines
}
elseif ($devent == sclick) {
if ($did == 8) {
if ($hget(pset,pastebin) == 2) {
did -ra $dname 22 Pastebin.com does not support password protection
did -u $dname 8
}
else { did $iif($did(8).state,-e,-rb) $dname 9 }
}
elseif ($did == 13) { dialog $iif($dialog(saved),-v,$hget(pset,sw)) saved saved }
elseif ($did == 11) && ($did(1) != $null) {
if ($sock(paste)) { did -ra $dname 22 Upload in progress }
else {
if ($did(8).state) && ($did(9) == $null) {
did -b $dname 9
did -u $dname 8
}
did -ra $dname 22 Uploading...
did -r $dname 15
sockopen paste $iif($hget(pset,pastebin) == 1,paste.stirk.org,pastebin.com) 80
}
}
elseif ($did == 16) && ($did(15)) { clipboard $did(15) }
elseif ($did == 12) {
.timerpaste off
dialog -x $dname
}
}
elseif ($devent == menu) {
;ADD EXTENSIONS
if ($did == 24) && ($did(1) != $null) {
var %fn $input(Save as (file name),oe,Save draft)
if ($isfile(pastebin $+ %fn $+ .txt)) {
if ($input(File name already exists. Overwrite?,yn,Save draft)) { .remove pastebin $+ %fn $+ .txt }
else { var %fn $false }
}
if (%fn) {
var %x 1
while (%x <= $did(1).lines) {
write pastebin $+ %fn $+ $iif(*.txt !iswm %fn,.txt) $did(1,%x)
inc %x
}
did -ra $dname 22 Saved as $qt(%fn)
}
}
elseif ($did == 25) {
var %fn $sfile($mircdirPastebin)
if ($regex(%fn,/.(txt|ini|mrc|dat)$/i)) {
var %x 1
did -r $dname 1
while (%x <= $lines(%fn)) {
did -a $dname 1 $read(%fn,n,%x) $+ $crlf
inc %x
}
did -ra $dname 22 Loaded $qt($nopath(%fn))
}
}
elseif ($did == 31) {
if ($msfile($mircdirPastebin,Delete files,Delete)) {
var %x 1
if ($hget(pset,prompt)) && (!$input(Are you sure you wish to delete $msfile(0) files?,yn,Delete drafts)) { return }
while ($msfile(%x)) {
if (*pastebin*.txt iswm $v1) { .remove $qt($v2) }
inc %x
}
}
did -ra $dname 22 Deleted $msfile(0) saved drafts.
}
elseif ($did == 35) { dialog $iif($dialog(saved),-v,$hget(pset,sw)) saved saved }
elseif ($did == 28) && ($did(1) != $null) {
var %x 1
clipboard
while (%x <= $did(1).lines) {
clipboard -a $+ $iif($v1 < $v2,n) $did(1,%x)
inc %x
}
}
elseif ($did == 32) { did -r $dname 1 }
elseif ($did == 29) {
did -r $dname 1
.comopen cb wscript.shell
.comclose cb $com(cb,sendkeys,1,bstr,^v)
}
elseif ($did == 30) { dialog $iif($dialog(psettings),-v,$hget(pset,sw)) psettings psettings }
}
elseif ($devent == close) { .timerpaste off }
}
on *:dialog:saved:*:*:{
if ($devent == init) {
var %x 1
while ($hget(paste,%x).item) {
did -a $dname 1 $v1
inc %x
}
}
elseif ($devent == sclick) {
if ($did == 1) && ($did(1).seltext) {
sockclose pload
sockopen pload $iif(stirk isin $v1,paste.stirk.org,pastebin.com) 80
did -ra $dname 5 Loading page...
did -ra $dname 7 $did(1).seltext
}
elseif ($did == 2) {
var %i $input(Add url (Pastebin.com/paste.stirk.org ONLY),oe,Add URL)
if ($regex(%i,/^(?:http://)?(paste.stirk.org|pastebin.com)/w+$/i)) {
did -a $dname 1 %i
hadd paste %i
}
}
elseif ($did == 3) && ($hfind(paste,$did(1).seltext)) {
if ($hget(pset,prompt)) && (!$input(Are you sure you wish to delete this URL?,yn,Delete URL)) { return }
hdel paste $hfind(paste,$did(1).seltext)
did -d $dname 1 $did(1).sel
}
elseif ($did == 8) && ($did(7)) { clipboard $v1 }
elseif ($did == 9) && ($did(5) != $null) {
var %x 1
clipboard
while (%x <= $did(5).lines) {
clipboard -a $+ $iif($v1 < $v2,n) $did(5,%x)
inc %x
}
}
}
}
on *:dialog:psettings:*:*:{
if ($devent == init) {
if ($hget(pset,description)) {
did -ae $dname 5 $v1
did -c $dname 4
}
else { did -c $dname 3 }
if ($hget(pset,author)) {
did -ae $dname 9 $v1
did -c $dname 8
}
else { did -c $dname 7 }
if ($hget(pset,password)) {
did -ae $dname 16 $v1
did -c $dname 15
}
else { did -c $dname 14 }
paste.hl $hget(pset,pastebin) $dname 12
did -c $dname 12 $hget(pset,highlighting)
if ($hget(pset,SaveURL)) { did -c $dname 11 }
did -c $dname $iif($hget(pset,pastebin) == 1,25,26)
tokenize 32 Day Month Forever
did -a $dname 28 $*
did -c $dname 28 $didwm(28,$hget(pset,expiry) $+ *)
if ($hget(pset,pastebin) == 2) { did -e $dname 28 }
did -a $dname 19 $hget(pset,count)
if ($hget(pset,prompt)) { did -c $dname 21 }
}
elseif ($devent == sclick) {
if ($istok(4 8 15,$did,32)) { did -e $dname $calc($did + 1) }
elseif ($istok(3 7 14,$did,32)) { did -rb $dname $calc($did + 2) }
elseif ($did == 23) { dialog -x $dname }
elseif ($did == 22) {
dialog -x paste
hadd pset description $did(5)
hadd pset Author $did(9)
hadd pset password $iif($did(25).state,$did(16))
hadd pset highlighting $did(12).sel
hadd pset SaveURL $did(11).state
hadd pset count $iif($did(19) isnum 0-10,$v1,1)
hadd pset Prompt $did(21).state
hadd pset pastebin $iif($did(25).state,1,2)
hadd pset expiry $lower($left($did(28),1))
.timer 1 0 dialog $hget(pset,sw) paste paste
dialog -x $dname
}
elseif ($did == 25) {
did -b $dname 28
did -r $dname 12
paste.hl 1 $dname 12
did -c $dname 12 1
}
elseif ($did == 26) {
did -e $dname 28
did -r $dname 12
paste.hl 2 $dname 12
did -c $dname 12 1
}
}
}
on *:sockopen:paste:{
if ($sockerr) {
did -ra paste 22 Error uploading content.
sockclose $sockname
return
}
var %x 1, %s sockwrite -n $sockname
while (%x <= $did(paste,1).lines) {
bset -t &cont $calc($bvar(&cont,0) + 1) $urlenc($did(paste,1,%x)) $+ $lf
inc %x
}
if ($hget(pset,pastebin) == 1) {
bset -t &head 1 input_text=
bcopy &head 12 &cont 1 $bvar(&cont,0)
bset -t &head $bvar(&head,0) &description= $+ $did(paste,3) $+ &name= $+ $did(paste,5) $+ $&
&input_password= $+ $did(paste,9) $+ &input_language= $+ $did(paste,6)
}
else {
bset -t &head 1 parent_pid=&format= $+ $iif($did(paste,6) == none,text,$v1) $+ &code2=
bcopy &head $calc($bvar(&head,0) + 1) &cont 1 $bvar(&cont,0)
bset -t &head $bvar(&head,0) &poster= $+ $did(paste,5) $+ &paste=Send&expiry= $+ $hget(pset,expiry) $+ &email=
}
%s POST / HTTP/1.0
%s Host: $sock($sockname).addr
%s Content-Type: application/x-www-form-urlencoded
%s Content-Length: $bvar(&head,0)
%s
%s &head
}
on *:sockread:paste:{
if ($sockerr) {
did -ra paste 22 Error uploading content.
sockclose $sockname
return
}
var %a
sockread %a
if ($hget(pset,pastebin) == 1) && ($regex(%a,/^<meta.+url=(.+?)"/i)) { var %url $regml(1) }
elseif (Location: *pastebin.com* iswm %a) { var %url $gettok(%a,2,32) }
if (%url) {
did -ra paste 22 Upload successful. Ready
did -a paste 15 %url
if ($did(paste,10).state) { hadd paste %url }
sockclose $sockname
}
}
on *:sockopen:pload:{
sockwrite -n $sockname GET / $+ $gettok($remove($did(saved,1).seltext,http://),2,47) HTTP/1.0
sockwrite $sockname Host: $sock($sockname).addr $+ $str($crlf,2)
}
on *:sockread:pload:{
var %a
sockread %a
if (<textarea isin %a) {
did -r saved 5
if ($html(%a) != $null) { did -a saved 5 $html(%a) $+ $crlf }
sockmark $sockname $true
}
elseif ($sock($sockname).mark) { did -a saved 5 $html(%a) $+ $crlf }
if (</textarea> isin %a) { sockclose $sockname }
}
on *:sockclose:pload:{ did -ra saved 5 Entry does not exist. }
mIRC v6.31 - I\'ve loaded the script and all works fine except:
s and W (Case sensitive) are turned into ones (1) on upload to the site... Wtf?
I\'m no noob, but I\'m a bit too tired to look into it right now. Fifteen Till One in the morning. ^.^
I\'d check up on that 20 line thing if you haven\'t already.
Great script, though. I look forward to any fixes - I\'ll sure use it.
and H_M \"Also, the way it\'s built, this doesn\'t send all the text, it only would send like 20 lines and that\'s it\"
http://paste.stirk.org/33244 < same code uploaded with the dialog, 418 lines