This script will bypass your browser, send your clipboard contents directly to the paste site and quickly return a link.
I wrote this to suite my own personal need, so if someone would like small adjustments made to the code, post your request here or contact me in #Script-Help on GeekShed.
Instructions:
- Copy the code below to your clipboard, paste it into a NEW remote and save it with a unique filename.
- Copy the code/text you want to upload to paste.kde to your clipboard. (CTRL+C)
- Press CTRL+F12 for automatic pasting using the default options in the "sets" alias. (Default options are; Syntax:mIRC, Author:Your irc Nick, Expires:1 week)
- Press SHIFT+F12 to adjust the options before uploading. You may also make the paste private and add a password here. (Keep in mind that the password alone does nothing. You must make the paste private and then the password is used to generate a hash-code that can be used to access the paste. Ex. http://paste.kde.org/PasteId/SecureHash/)
Screen Shot:
- Code: Select all
;Paste KDE by Ford_Lawnmower irc.geekshed.net #Script-Help CTRL+F12 to send your clipboard contents automatically.
;SHIFT+F12 for more paste options.
alias -l Sets {
goto $prop
;Change language to the default language you want on automatic pastes. Valid codes-->> http://paste.kde.org/doc/lang
:language
return mirc
;Change for default expiration in seconds. You may replace $expire(x) with a value in seconds.
;$expire(x) values. 1=5 min, 2=30 min, 3=60 min, 4=6 hr, 5=1 day, 6=1 week, 7=1 month, 8=1 year, 9= never
:expire
return $expire(6)
;Change user to change the author of the paste.
:user
return $me
}
alias kdepaste { Getford.kde.paste echo -a $sets().Language $sets().expire $sets().user 0 0 }
alias -l Getford.kde.paste {
var %sockname $+(ford.kde.paste,$network,$2,$ticks)
var %post $+(mode=xml&api_submit=true&paste_lang=,$3,&paste_expire=,$4,&paste_user=,$5,$iif($6,&paste_private=yes),$iif($7,$+(&paste_password,$7)),&paste_data=)
sockopen %sockname paste.kde.org 80
sockmark %sockname $1-2 %post
}
On *:sockopen:ford.kde.paste*: {
if (!$sockerr) {
tokenize 32 $sock($sockname).mark
var %len $calc($len($3-) + $cbEncodeLen + ($cb(0) * 2))
sockwrite -n $sockname POST / HTTP/1.1
sockwrite -n $sockname Host: $sock($sockname).addr
sockwrite -n $sockname Content-Type: application/x-www-form-urlencoded
sockwrite -n $sockname Content-Length: %len
sockwrite -n $sockname Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3
sockwrite -n $sockname User-Agent: Opera 9.6
sockwrite -n $sockname $crlf
sockwrite $sockname $3-
var %line 1
while (%line <= $cb(0)) {
sockwrite -n $sockname $urlencode($cb(%line))
inc %line
}
sockwrite -n $sockname
}
else { echo -st Socket Error $nopath($script) | sockclose $sockname | return }
}
On *:sockread:ford.kde.paste*: {
if ($sockerr) { echo -st Socket Error $nopath($script) | sockclose $sockname | return }
else {
var %ford.kde.paste | sockread -f &ford.kde.paste
%ford.kde.paste = $bvar(&ford.kde.paste,1-).text
if ($regex(hash,%ford.kde.paste,/<hash>(.*?)<\/hash>/i)) noop
if ($regex(id,%ford.kde.paste,/<id>(.*?)<\/id>/i)) {
var %link $+(http://paste.kde.org/,$regml(id,1),$iif($regml(hash,1),$+(/,$v1)))
$gettok($sock($sockname).mark,1-2,32) Link with syntax Highlights: $+(%link,$chr(15)) || Raw paste link: $+(%link,/raw/,$chr(15))
}
}
}
dialog paste_kde {
title "Paste KDE"
size -1 -1 104 100
option dbu
text "User:", 1, 3 8 25 8
text "Language:", 2, 3 24 25 8
text "Expire:", 3, 3 39 25 8
text "Password:", 4, 3 70 25 8
edit "", 5, 30 7 73 10, autohs
combo 6, 31 23 72 10, vsbar drop
combo 7, 31 38 72 10, vsbar drop
check "Make Private", 8, 3 54 46 10, left
edit "", 9, 32 68 70 10, pass autohs
button "Send", 10, 70 83 32 12
button "Close", 11, 34 83 34 12, cancel
}
On *:dialog:paste_kde:init:*: {
did -a $dname 5 $me
didtok -a $dname 6 124 $languages().names
didtok -a $dname 7 44 5 minutes,30 minutes,1 hour,6 hours,1 day,1 week,1 month,1 year,never
did -c $dname 6 109
did -c $dname 7 6
}
on *:dialog:paste_kde:Sclick:10: {
Getford.kde.paste echo -ga $languages($did(6).sel).code $expire($did(7).sel) $did(5) $did(8).state $iif($did(9),$v1,0)
}
alias SF12 dialog $iif(!$dialog(paste_kde),-m paste_kde,-v) paste_kde
alias CF12 kdepaste
alias -l Languages {
var %names $regsubex(GADV 4CS|ACME Cross Asm|Kick Asm|TASM/64TASS 1.46 Asm|HiSoft Devpac ST 2 Asm|ABAP|ActionScript|ActionScript 3|$&
Ada|ALGOL 68|Apache configuration|AppleScript|Apt sources|ASM|ASP|Autoconf|Autohotkey|AutoIt|AviSynth|awk|Bash|Basic4GL|$&
Brainfuck|BibTeX|BlitzBasic|bnf|Boo|C|C (LoadRunner)|C (Mac)|CAD DCL|CAD Lisp|CFDG|ColdFusion|ChaiScript|CIL|Clojure|CMake|$&
COBOL|C++|C++ (Qt)|C#|CSS|Cuesheet|D|DCS|Delphi|Diff|DIV|DOS|dot|E|ECMAScript|Eiffel|eMail (mbox)|EPC|Erlang|Formula One|$&
Falcon|FO (abas-ERP)|Fortran|FreeBasic|F#|GAMBAS|GDB|genero|Genie|GNU Gettext|glSlang|GML|Gnuplot|Go|Groovy|GwBasic|Haskell|$&
HicEst|HQ9+|HTML|Icon|Uno Idl|INI|Inno|INTERCAL|Io|J|Java|J2SE|Javascript|jQuery|KiXtart|KLone C|KLone C++|LaTeX|Liberty BASIC|$&
Lisp|Locomotive Basic|Logtalk|LOLcode|Lotus Notes|LotusScript|LScript|LSL2|Lua|Motorola 68000 Asm|MagikSF|GNU make|MapBasic|$&
Matlab M|mIRC Scripting|MMIX|Modula-2|Modula-3|Microchip Asm|MXML|MySQL|newlisp|NSIS|Oberon-2|Objective-C|Objeck|OCaml|$&
OCaml (brief)|OpenOffice.org Basic|Oracle 11 SQL|Oracle 8 SQL|Oxygene (Delphi Prism)|OZ|Pascal|PCRE|per|Perl|Perl 6|$&
OpenBSD Packet Filter|PHP|PHP (brief)|PIC16|Pike|Pixel Bender 1.0|PL/SQL|PostgreSQL|POVRAY|PowerBuilder|PowerShell|Progress|$&
Prolog|PROPERTIES|ProvideX|PureBasic|Python|q/kdb+|QBasic/QuickBASIC|Rails|REBOL|Microsoft Registry|robots.txt|$&
RPM Specification File|R / S+|Ruby|SAS|Scala|Scheme|SciLab|sdlBasic|Smalltalk|Smarty|SQL|SystemVerilog|TCL|Tera Term Macro|$&
thinBasic|T-SQL|TypoScript|Unicon|Vala|Visual Basic|VB.NET|Verilog|VHDL|Vim Script|Visual Fox Pro|Visual Prolog|Whitespace|$&
Whois (RPSL format)|Winbatch|XBasic|XML|Xorg configuration|X++|ZiLOG Z80 Asm|ZXBasic|None,/(\x7c\s)/g,|)
var %codes $regsubex(4cs|6502acme|6502kickass|6502tasm|68000devpac|abap|actionscript|actionscript3|ada|algol68|apache|applescript|$&
apt_sources|asm|asp|autoconf|autohotkey|autoit|avisynth|awk|bash|basic4gl|bf|bibtex|blitzbasic|bnf|boo|c|c_loadrunner|c_mac|$&
caddcl|cadlisp|cfdg|cfm|chaiscript|cil|clojure|cmake|cobol|cpp|cpp-qt|csharp|css|cuesheet|d|dcs|delphi|diff|div|dos|dot|e|$&
ecmascript|eiffel|email|epc|erlang|f1|falcon|fo|fortran|freebasic|fsharp|gambas|gdb|genero|genie|gettext|glsl|gml|gnuplot|go|$&
groovy|gwbasic|haskell|hicest|hq9plus|html4strict|icon|idl|ini|inno|intercal|io|j|java|java5|javascript|jquery|kixtart|klonec|$&
klonecpp|latex|lb|lisp|locobasic|logtalk|lolcode|lotusformulas|lotusscript|lscript|lsl2|lua|m68k|magiksf|make|mapbasic|matlab|$&
mirc|mmix|modula2|modula3|mpasm|mxml|mysql|newlisp|nsis|oberon2|objc|objeck|ocaml|ocaml-brief|oobas|oracle11|oracle8|oxygene|oz|$&
pascal|pcre|per|perl|perl6|pf|php|php-brief|pic16|pike|pixelbender|plsql|postgresql|povray|powerbuilder|powershell|progress|prolog|$&
properties|providex|purebasic|python|q|qbasic|rails|rebol|reg|robots|rpmspec|rsplus|ruby|sas|scala|scheme|scilab|sdlbasic|smalltalk|$&
smarty|sql|systemverilog|tcl|teraterm|thinbasic|tsql|typoscript|unicon|vala|vb|vbnet|verilog|vhdl|vim|visualfoxpro|visualprolog|$&
whitespace|whois|winbatch|xbasic|xml|xorg_conf|xpp|z80|zxbasic|none,/(\x7c\s)/g,|)
goto $prop
:names
return %names
:code
return $gettok(%codes,$1,124)
}
alias -l expire return $gettok(300|1800|3600|8640|86400|604800|2592000|31536000|0,$1,124)
alias -l cbEncodeLen {
var %len, %line 1
while (%line <= $cb(0)) {
%len = $calc(%len + $len($urlencode($cb(%line))))
inc %line
}
return %len
}
alias -l urlencode return $replace($regsubex($1-,/([^a-z0-9\x20])/gi,$+(%,$iif($base($asc(\t),10,16) isnum 1-9,0),$base($asc(\t),10,16))),$chr(32),+)