ImageShack Picture Viewer. NOW You can view pics inside mIRC!

By FelicianoX on Aug 15, 2011

Hi,
With this script you can browse through all of the imageshack.us pictures you've double clicked on. AND also you can right click a link and the picture will pop up in your mIRC screen!

Right click link to view pic inside mIRC.

UPDATES:
[30 January] Will still work if you have ~450+ pictures saved.
[30 January] Removing pictures via dialog is now x5 faster/easier.
[25 March] You can now choose to open the last 250 pictures downloaded (Loads faster)
[25 Dec] You can now right click the link to view it/download it inside your mIRC without it having to open a browser! (Right click link)

Thanks to some help in #mSL and http://mircscripting.info/forum/viewtopic.php?t=1382&sid=08fd450cce5b4171738c3c2a60e2287f

LINKS: http://img832.imageshack.us/img832/9848/iamgeag.jpg
http://i.imgur.com/pYUxq.png

/*
100% by FelicianoX (#mSL @ irc.swiftirc.net)
ImageShack Picture Viewer
*/

on *:LOAD:{ if (!$isdir($mircdirDLImages)) { mkdir DLImages | echo -a 06Thanks for using Image Viewer, memo/pm FelicianoX for questions } }

on *:START:{ .timerImageLinks 0 3600 imagelinkscheck }

on $^*:HOTLINK:/http\x3A\/\/((img\d{1,3})\.imageshack\.us)(\/\2\/\d+\/\w+\.(png|jpg|gif))/Si:#:{
  if ($mouse.key & 16) {
    openToolTip $1
  }
  if (!$hget(ImageLinks,$1) && $group(#Image).status == On) {
    .disable #Image
    .hfree ImageLinks
    hadd -m ImageLinks $1 1
    .enable #Image
  }
  if ($group(#Image).status == off) {
    .enable #Image
    hadd -m ImageLinks $1 1
  }
}

menu @ImageShack {
  sclick: {
    if ($inrect($mouse.x, $mouse.y, $calc($window(@ImageShack).w -110), 3, 90, 20)) {
      window -c @ImageShack
      unset %file
    }
    elseif ($inrect($mouse.x, $mouse.y, 10, 2, 110, 20)) {
      noop $input(Image deleted, oi, ImageShack Tooltip)
      .remove %file
      imagelinkscheck
    }
  }
}

on *:CLOSE:@ImageShack:{ unset %file }

alias openToolTip {
  if ($readini(ImageLinks.ini, Downloaded, $1)) {
    set %file $qt($mircdirDLImages\ $+ $gettok($1, -1, $asc(/)))
    var %width = $pic(%file).width, %height = $pic(%file).height
    window -Cpobfdk0 +b @ImageShack 0 0 %width $calc(%height +18)
    drawpic -s @ImageShack 1 19 %file
    drawtext @ImageShack 4 $calc(%width -100) 2 [X] CLOSE
    drawtext @ImageShack 4 10 2 Delete image.
    titlebar @ImageShack Picture Viewer ToolTip 
  }
  else {
    noop $regex($1,/http\x3A\/\/((img\d{1,3})\.imageshack\.us)(\/\2\/\d+\/\w+\.(png|jpg|gif))/Si)
    window -Cpobfdk0 +b @Downloading 0 0 350 40
    drawtext @Downloading 4 10 15 Image is being downloaded, please wait...
    titlebar @Downloading image, please wait.
    var %t $ticks
    hadd -m $+(ImageSocket.,%t) GET $regml(3)
    hadd $+(ImageSocket.,%t) Host $regml(1)
    hadd $+(ImageSocket.,%t) Tooltip $true
    sockopen $+(image.,%t) $regml(1) 80
  }
}

#Image on

on $*:HOTLINK:/http\x3A\/\/((img\d{1,3})\.imageshack\.us)(\/\2\/\d+\/\w+\.(png|jpg|gif))/Si:#:{
  url $1
  if (!$readini(ImageLinks.ini,Downloaded,$1)) {
    var %t $ticks
    hadd -m $+(ImageSocket.,%t) GET $regml(3)
    hadd $+(ImageSocket.,%t) Host $regml(1)
    sockopen $+(image.,%t) $regml(1) 80
  }
}

#Image end

on *:sockopen:image.*:{
  var %a sockwrite -nt $sockname
  %a GET $hget($+(ImageSocket.,$gettok($sockname,2,46)),GET) HTTP/1.0
  %a Host: $hget($+(ImageSocket.,$gettok($sockname,2,46)),Host) $+ $str($crlf,2)
}

on *:sockread:image.*:{
  if (!$sock($sockname).mark) {
    var %a
    sockread %a
    if (%a == $null) {
      sockmark $sockname 1
    }
  }
  else {
    sockread &image
    var %o $gettok($hget($+(ImageSocket.,$gettok($sockname,2,46)),GET),3,47))
    bwrite $qt($+($mircdirDLImages\,%o)) -1 -1 &image
  }
}

on *:sockclose:image.*:{
  var %l $+(http://,$hget($+(ImageSocket.,$gettok($sockname,2,46)),Host),$hget($+(ImageSocket.,$gettok($sockname,2,46)),GET))
  writeini -n ImageLinks.ini Sizes $+(http://,$hget($+(ImageSocket.,$gettok($sockname,2,46)),Host),$hget($+(ImageSocket.,$gettok($sockname,2,46)),GET)) $bytes($lof($+($mircdirDLImages\,$gettok($hget($+(ImageSocket.,$gettok($sockname,2,46)),GET),3,47))),k) kilobytes
  writeini -n ImageLinks.ini Downloaded %l 1
  if ($hget($+(ImageSocket.,$gettok($sockname,2,46)), Tooltip)) {
    openToolTip %l
    window -c @Downloading
  }
  hfree -w $+(ImageSocket.,$gettok($sockname,2,46))
}

alias ImageLinksCheck {
  !var %a $iif(%last,$calc($ini(ImageLinks.ini,Downloaded,0) -250),1)
  !while (%a <= $ini(ImageLinks.ini,Downloaded,0)) {
    !if ($isfile($+($mircdirDLImages\,$gettok($ini(ImageLinks.ini,Downloaded,%a),5,47))) == $false) {
      !remini -n ImageLinks.ini Downloaded $ini(ImageLinks.ini,Downloaded,%a)
      !remini -n ImageLinks.ini Sizes $ini(ImageLinks.ini,Sizes,%a)
      !inc %a
    }
    !inc %a
  }
}

dialog ImagesView {
  title "ImageShack Picture Viewer"
  size -1 -1 933 497
  option pixels
  list 1, 758 22 138 447
  box "Image", 2, 15 17 723 438
  icon 3, 40 33 675 410, $pic ,0
  text "Size:", 4, 24 464 100 17
  button "Copy link", 5, 667 464 65 25
  button "Open folder", 6, 758 464 70 25
  button "Update List", 7, 845 464 70 25
  button "Delete", 8, 580 464 65 25
}

alias -l pic return $+($mircdirDLImages\,$gettok($ini(ImageLinks.ini,Downloaded,$iif(%last,$calc($ini(ImageLinks.ini,Downloaded,0) -250),1)),5,47))

alias -l pics return $bytes($lof($pic),k) kb

alias -l openimagelinks { 
  set %Last $iif($1 && $ini(ImageLinks.ini,Downloaded,0) > 249,1)
  dialog -m ImagesView ImagesView
}

menu channel {
  .ImageShack Picture Viewer
  ..ImageShack Picture Viewer: openimagelinks
  ..ImageShack Picture Viewer 250: openimagelinks 1
}

on *:DIALOG:ImagesView:init:0:{
  !did -b ImagesView 5,8
  !did -c ImagesView 1 1
  !did -a ImagesView 4 Size: $pics
  !var %a $iif(%last,$calc($ini(ImageLinks.ini,Downloaded,0) -250),1)
  !while (%a <= $ini(ImageLinks.ini,Downloaded,0)) {
    !did -a ImagesView 1 $gettok($ini(ImageLinks.ini,Downloaded,%a),5,47)
    !inc %a
  }
}

on *:DIALOG:ImagesView:close:0:{
  unset %Last
}

on *:DIALOG:ImagesView:sclick:1,5-8:{
  if ($did == 1) {
    !did -g ImagesView 3 $qt($+($mircdirDLImages\,$did(ImagesView,1).seltext))
    !did -a ImagesView 4 Size: $bytes($lof($+($mircdirDLImages\,$did(ImagesView,1).seltext)),k) kb
    !did -e ImagesView 5,8
  }
  elseif ($did == 5) {
    if (%last) clipboard $ini(ImageLinks.ini,Downloaded,$calc($ini(ImageLinks.ini,Downloaded,0) - 251 + $did(ImagesView,1).sel)))
    else clipboard $ini(ImageLinks.ini,Downloaded,$did(ImagesView,1).sel)
    !did -a ImagesView 5 Link Copied
    .timerIV 1 1 did -a ImagesView 5 Copy Link
  }
  elseif ($did == 6) {
    run $mircdirDLImages
  }
  elseif ($did == 7) {
    imagelinkscheck
    !did -r ImagesView 1
    !var %a $iif(%last,$calc($ini(ImageLinks.ini,Downloaded,0) -250),1)
    !while (%a <= $ini(ImageLinks.ini,Downloaded,0)) {
      !did -a ImagesView 1 $gettok($ini(ImageLinks.ini,Downloaded,%a),5,47)
      !inc %a
    }
    !did -b ImagesView 5,8
  }
  elseif ($did == 8) {
    .remove $+(DLImages\,$did(ImagesView,1).seltext)
    did -d ImagesView 1 $did(ImagesView,1).sel
  }
}

Comments

Sign in to comment.
[85]   -  Dec 26, 2011

good job...

 Respond  
FelicianoX   -  Dec 24, 2011

UPDATED

 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.