Paste Utilities v1.1

By sladekraven on Mar 02, 2006

Paste Utilities v1.1 (mIRC 6.17!) But will take you straight to mIRC 6.17 setup if version is not 6.17




This snippet manipulates your clipboard entries, using mIRC 6.17's new check property for the listbox control you can select the text you lines you want to paste.




You can choose to echo or message the lines but one has to be selected.




I've added a few options, since I only use mIRC's default timestamp format ($timestampfmt) I added the option to remove the default (HH:nn), a timer to delay the text and all check boxes on by default if the box isn't checked and the dialog is re-opened the check boxes are of course not checked.

;******************************************************************
;Credits: {
;   genuius_at_work: Hard work and effort in an identifier I decided not to go with.
;   Khaled: mIRC, Arnie, mIRC and uh... mIRC?
;}
;******************************************************************

On *:Start: {
  set %cp.version 1.1
}

On *:Load: {
  if ($version < 6.17) { 
    echo -a We're sorry this Paste Utilities addon only works with mIRC 6.17 referring you to download...
    echo -a To download click save, to exit click cancel.
    url -n http://www.gone.se/mirc/mirc617.exe
    .unload -rs $+(",$script,") 
  }
  else {
    echo -a Welcome to the Paste Utilities addon, if your F1 key is in use by a different command type /cp.
    echo -a Here you can view the lines of text in your clip board and select the ones you want to paste.
    echo -a You can choose how you'd like to paste whether it's echo to yourself or display to the active window.
    echo -a This addon was coded by SladeKraven (Andy) and tested by Dr|Cameron/Oxedizer (Matt)
  }
}

menu channel {
  Paste: {
    f1
  }
}

dialog cp {
  title "SladeKraven's Paste Utilities V1.1"
  size -1 -1 181 114
  option dbu
  tab "         Paste Utilities        ", 7, 0 -2 183 116
  text "", 3, 26 14 142 14, tab 7
  list 2, 25 29 144 65, size check tab 7
  button "Yes", 4, 52 97 37 12, tab 7
  button "No", 5, 95 97 37 12, cancel tab 7
  check "Select Result", 6, 137 98 50 10, 3state tab7 

  tab "         Options         ", 8
  box "Paste Utilities Options", 12, 39 15 109 37, tab 8
  check "Strip default $timestamp.", 13, 44 22 96 10, tab 8
  check "Add timer to delay the display of text.", 14, 44 31 102 10, tab 8
  check "Check Boxes On by default.", 15, 44 40 88 10, tab 8

  tab "         About         ", 9
  text "The Paste Utilities addon basically evolved from mIRC's built in Confirm Paste feature.  This is completely different because you don't need to paste anything to open the dialog as it's called from F1 which can be changed if you want.", 10, 3 16 180 27, tab 9
  text "When anything is in your clipboard you can hit the Function Key to display the lines of text.  This is meant for mIRC versions 6.17 and up because it uses mIRC's new check property for the listbox control.  This is so you can check or uncheck the lines of text you wish to display either by msg or echo.", 11, 3 46 180 34, tab 9
  edit "", 16, 29 84 114 10, tab 9 read center
  button "Check for updates!", 17, 53 97 63 12, tab 9
}

On *:Dialog:cp:*:*: {
  if ($devent == close) {
    unset %cp.method
  }
  if ($devent == init) {
    if (%cp.strip == 1) did -c $dname 13
    if (%cp.timer == 1) did -c $dname 14
    if (%cp.default == 1) did -c $dname 15
    did -a $dname 3 Are you sure you want to paste $iif($cb(0),$cb(0),0) line(s) of text into this window?
    var %x = 1
    while (%x <= $cb(0)) {
      did -a $dname 2 $cb(%x)
      if (%cp.default == 1) did -s $dname 2 %x
      inc %x
    }
  }
  if ($devent == sclick) {
    if ($did == 4) {
      var %x = 1
      while (%x <= $did($dname,2,0).csel) {
        if (%cp.method) {
          if (%cp.method == 1)  { 
            if (%cp.strip == 1) $iif(%cp.timer == 1,.timer 1 %x) echo -a $istimestamp($did($dname,2,%x))
            else { $iif(%cp.timer == 1,.timer 1 %x) echo -a $did($dname,2,%x) }
          }
          else { 
            if (%cp.strip == 1) $iif(%cp.timer == 1,.timer 1 %x) msg $active $istimestamp($did($dname,2,%x))
            else { $iif(%cp.timer == 1,.timer 1 %x) msg $active $did($dname,2,%x) }
          }
        }
        inc %x
      }
    }
    if ($did == 6) {
      if ($did($dname,6).state == 0) unset %cp.method
      elseif ($did($dname,6).state != 0) set %cp.method $did($dname,6).state
      did -a $dname 6 $iif($did($dname,6).state == 1,Echo,$iif($did($dname,6).state != 0,MSG,Select)) Result
    }
    if ($did == 13) { set %cp.strip $iif($did($dname,$did).state == 1,1,0) }
    if ($did == 14) { set %cp.timer $iif($did($dname,$did).state == 1,1,0) }
    if ($did == 15) { set %cp.default $iif($did($dname,$did).state == 1,1,0) }
    if ($did == 17) {
      cp.update
    }
  }
}

alias f1 {
  if (!$dialog(cp)) dialog -dm cp cp
}

alias istimestamp {
  if ($+([,*:*,]) iswm $gettok($1,1,32)) return $gettok($1-,2-,32)
  else { return $1- }
}

alias cp.update { 
  if (!$sock(cp.update)) sockopen cp.update www.andrewgabriel.co.uk 80 
}

on *:sockopen:cp.update: { 
  sockwrite -n $sockname GET /update.txt HTTP/1.1
  sockwrite -n $sockname Host: www.andrewgabriel.co.uk $+ $crlf $+ $crlf
  sockwrite -n $sockname Content-type: text/plain
  sockwrite -n $sockname 
}

alias -l html {
  var %x, %i = $regsub($1-,/(^[^<]*>|<[^>]*>|<[^>]*$)/g,$null,%x), %x = $remove(%x,&nbsp;)
  return %x
}

on 1:sockread:cp.update: {
  if ($sockerr > 0) return
  :cpdata
  sockread %cp.data
  if ($sockbr == 0) { 
    return
  }
  if (latest version isin $html(%cp.data)) {
    if (%cp.version < $mid($gettok($v2,24,32),1,3)) {
      did -a cp 16 Need update latest version is ( $+ $v2 $+ )
      url -n $+(http://www.andrewgabriel.co.uk/cp,$v2,.zip)
    }
    else { 
      did -ra cp 16 You have the latest version.
    }
  }
  goto cpdata
}

Comments

Sign in to comment.
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.