Clipboard to Pastebin

By Savage_CL on Sep 29, 2012

Pretty easy, once you get it set up.

Make sure you set the options to your preference

API keys available at http://pastebin.com/api

Any issues, let me know!

use F12 to quick paste clipboard (comment out that alias if you use f12 for something else)
alternatively, use /paste
If you would like to choose your post duration, use /paste -l

Enjoy!

/*
######################
#                    #
# Clipboard Paste    #
# By: Jordan`        #
# Find at #Savage_CL #
# on SwiftIRC        #
#                    #
######################

To use this script, you must have a pastebin API key!
go to http://Pastebin.com/api to get one!

After you have one, put in on line 25 in place of KEY_HERE
*/

/*
##################
#                #
#    settings    #
#                #
##################
*/
;Key goes on the next line
alias -l API_KEY return PUT_KEY_HERE
;this option will cause the program to beep twice on success (TRUE or FALSE)
alias -l OPTION_BEEP return TRUE
;this option will cause the program to echo a message on success (TRUE or FALSE)
alias -l OPTION_ECHO return TRUE

alias F12 paste
alias paste {
  var %l
  if ($1 == -l) %l = $iif($input(Paste Duration?,m,$active,Paste Time,N: Never,10M: 10 minutes,1H: 1 Hour,1D: 1 Day,1M: 1 month),$gettok($v1,1,58),1D)
  else %l = 1D
  var %sockname = paste. $+ $ticks
  sockopen %sockname pastebin.com 80
  sockmark %sockname %l
}
on *:SOCKOPEN:paste.*:{
  var %i = 1
  bset -t &post $calc($bvar(&post, 0) + 1) api_option=paste&api_dev_key= $+ $API_KEY $+ &api_paste_private=1&api_paste_expire_date= $+ $sock($sockname).mark $+ &api_paste_code= 
  while (%i <= $cb(0)) {
    bset -t &post $calc($bvar(&post, 0) + 1) $cb(%i) $+ $iif(%i != $cb(0),$crlf)
    inc %i
  }
  var %s = sockwrite -n $sockname
  %s POST /api/api_post.php HTTP/1.1
  %s Host: pastebin.com
  %s Content-Type: application/x-www-form-urlencoded
  %s Content-Length: $bvar(&post, 0)
  %s $crlf
  %s &post
}
on *:SOCKREAD:paste.*:{
  if ($sockerr) .timer 1 0 noop $!input(An error occured: $crlf $+ $sockerr , o,ERROR)
  var %t 
  sockread %t
  if (($chr(44) isin %t) && (date !isin %t)) {
    .timer 1 0 noop $!input(An error occured: $crlf $+ $replace(%t,$chr(44),$chr(58)) ,o,ERROR)
    sockclose $sockname
  }
  elseif (http://pastebin.com/ isin %t) {
    clipboard %t
    if ($option_beep) beep 2 250
    if ($option_echo) echo 7 -a Pasted (URL on clipboard)
    sockclose $sockname
  }
}

Comments

Sign in to comment.
uneek   -  Dec 06, 2012

Any way to make it so you can set a start and stopping point in chat, remotely?

Say you are having a meeting and want to record the chat, you'd type !start
then !stop when done. And it would record everything typed in between and send it to pastebin?

Savage_CL  -  Aug 09, 2013

Something like that would be a separate "add-on". You would use on INPUT and on TEXT events to record what is said, maybe if a certain variable is set. You may write these lines to a temporary file or hidden window, then when done, write that window to pastebin.

Sign in to comment

Savage_CL   -  Oct 10, 2012

Glad you like it, chorao. I would ask, however, that you get your own API key, as leaving mine in there was a mistake.

 Respond  
chorao   -  Oct 06, 2012

Very NICE MAN!!! GOOD WORK!!

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.