Typos ViewPic

By Typo on Aug 20, 2008

Typos ViewPic makes viewing pictures inside of mirc a breeze. To view a picure in mirc you simply double click a link to a photo online or type /ViewPic to launch the file selection dialog so you can choose your photo or you can follow /ViewPic with the Drive:\Path\To\filename.ext (eg. C:\Pictures\photo.jpg) of the picture you wish to view.

FEATURES

Photo Album:
The script has a built in photo album that will display 16 photos each page. To view any photo normally you simply double click it to open it in viewpic. You can select what folder to view and it will remember the folder for the next time you open the album. You can also delete files from within the photo album by single clicking a picture to select it and then using the delete button.

Zoom:
With the zoom feature you can zoom in by left clicking on the image. Wherever you click is where it will center the zoomed image. The first click will zoom to 1.5x, the second click zooms to 2x, the third click zooms to 2.5x and the click after that will return you to the normal view. Pressing any other key at any time during the zoom process will also return the view to normal.

Slideshow:
The slideshow feature. You can select "Start a slideshow" from any of the rightclick menus and also by using the slideshow button in the photo album. To stop the slideshow, simply hit any key or click with the mouse. The delay between photos is adjustable in the viewpic control panel and defaults at 4 seconds.
If you run the slideshow when a picture is not loaded it will default to the viewpic's save folder which is set in the control panel. If you start it by right clicking on a picture it will use the folder of the currently loaded picture and using the button in the photo album will start a slideshow in the whichever folder the photo album is in.

Scrolling:
You can scroll through the pictures in the folder of the currently loaded picture by pressing +, RightArrow or PgUp to go forward and -. LeftArrow or PgDn to go back or you can use the right click menu to scroll either way.

Fullscreen View:
While viewing a picture you can toggle between regular view and fullscreen at any time by double clicking the photo, pressing any key except for +, -, PgUp, PgDn, LeftArrow and RightArrow or by using the right click menu. You can resize the loaded picture to any size you wish. You can return to normal view the same way you switch between normal and fullscreen views. The animated gif's cannot be toggled to full screen or reized.

Online Picture Viewing/Automatic Downloading:
It supports links to pictures online by allowing you to just double click the link like normal to have the picture automatically downloaded and displayed right inside of mirc. This means no more opening a web browser just to view a picture.
When viewing an online photo you will be presented with a progress bar while the photo is downloaded incase its a large picture. This way you know the scripts working on loading your picture.

Animated Gifs:
I have added the ability to support animated gifs. It works with most animated gifs but a small amount cannot be displayed properly due to limitations in Mirc Picture Windows.
When it encounters an animated gif it cannot animate you will be notified and the first frame in the animation will be displayed. There may also be some lagging in very highly detailed animated gifs but most that were tested displayed just fine.

Resizing:
If the picture is larger than 90% of the screens resolution it will be stretched down to less than that. The amount of stretching will depend on the aspect ratio and size of the photo. All the pictures that are smaller than 90% of your resolution will be displayed at their original resolution. This prevents the picture from covering the Windows taskbar or the Mirc titlebar.

Saving Photos:
You can select whether or not to automatically save all downloaded pictures into the default /viewpic/ folder which the script will create on install or any folder of your choice.
You can right click when viewing a picture and select "Save the current picture as..." to save a copy of the picture. You will be prompted for the folder to save to and what to name it.

Custom Menus:
I had to rebuild the default right click menu that used to show up when you right click on a link to a picture since it was gone due to me taking over the double click action on those links. All other links were unnaffected. The replacement right click menu looks, feels and acts like a normal windows/mirc right click menu. The options are "Copy address", "Open in new browser window" and "Open in active window".

As usual, just paste the code into a new remote file and save. (Even when updating.)
Image
Image
Image
Updated 08/24/2008

  1. Added the ability to resize pictures and some minor bug fixes.

Updated 08/28/2008

  1. Made a whole new timeout system that uses the http standard timeout scheme which times out if the speed falls below 150 bps. It also timesout after 2 minutes (adjustable).
  2. The socket now has better handling of dead url's or links to files that arent really there but the server tries a redirect and I made improvements and fixes to the sockclose event.
  3. Made fixes to the recently added resize system after I noticed a problem with it.
  4. Changed the way the script stores the file name while running. It used to store the whole path and filename int he titlebar but since having only the filename there looks better I am now using a variable to store that info.
  5. The script now remembers the last folder you were browsing in when loading a picture locally and opens in that folder the next time.
  6. Now checks on install to make sure you are running mirc 6.3 or higher. (This means a future update will likely include moving "" back to $qt and going back to using noop. I was trying to make the script compatible with older versions but in the end had no luck.
  7. On top of that there are a lot of various code changes and/or fixes throughout the entire script.

Updated 09/04/2008

  1. Added a photo album. It displays 16 photos a page lets you simply double click a picture to open it in viewpic. You can select what folder to view and it will remember the folder for the next time you open the album. You can also delete files from within the photo album by single clicking a picture to select it and then using the delete button.
  2. Added the ability to double click a picture to toggle between normal and fullscreen view as requested by zmodem.
  3. Fixed a bug that wasn't copying the file like it was supposed to when the save downloads option was enabled (this problem was from the previous update).
  4. Various other smaller bug fixes and coding updates.

Updated 09/06/2008

  1. Added the ability to scroll forward and backword a picture at a time in the folder of the currently loaded picture using either +/-, PgUp,PgDn, LeftArrow/RightArrow or the right click menu. This is for when viewing photos normally, not in the photo album.
  2. Added a button in the photo album to open the currently selected folder.
  3. Fixed the file display in the photo album to not include the path since the path is already displayed up top.
  4. Fixed the photo album dialog to display immediatley after deleting a file instead of loading the images and then making the dialog visible again.
  5. Multiple minor visual fixes to the photo album dialog.
  6. Fixed the On Load event to function properly.
  7. Fixed the timeout system to avoid false timeouts.
  8. Various other smaller bug fixes and coding updates.

Updated 9/21/2008

  1. Added the ability to zoom in by left clicking on the image. Wherever you click is where it will center the zoomed image. The first click will zoom to 1.5x, the second click zooms to 2x, the third click zooms to 2.5x and the click after that will return you to the normal view. Pressing any other key at any time during the zoom process will also return the view to normal.
  2. Added a slideshow feature. You can select "Start a slideshow" from any of the rightclick menus and also by using the slideshow button in the photo album. To stop the slideshow simply hit any key or click with the mouse. The delay between photos is adjustable in the viewpic control panel and defaults at 4 seconds.
    ...If you run the slideshow when a picture is not loaded it will default to the viewpic's save folder which is set in the control panel. If you start it by right clicking on a picture it will use the folder of the currently loaded picture and using the button in the photo album will start a slideshow in the whichever folder the photo album is in.
  3. Fixed an error with the aspect ratio in the full screen view which went undiscovered until now due to the small amount of affected photos.
  4. Various other smaller bug fixes and coding updates.

Be sure to unload the old copy and then load the new one when updating.

;Typos ViewPic
;For use on mIRC 6.3 or higher.
;
;This script has many usefull pieces to it that can be used seperately with a little editing and in some cases even no editing at all. 
;For instance I designed the /ViewPicAll (originally going to be named pic2win) alias to work as a standalone alias for simple photo viewing.  Thats why /ViewPicAll supports gif even tho it wont ever be sent one in the script due to /ViewPicAG handling all gifs for animated gif support.
;The /ViewPicAG alias is also functional as a standalone for gif/animated gif support as long as you remember to grab the /ViewPicAG2 alias with it.  
;The socket event thats used to dynamically download the photo from any photo link that is double clicked could be very very easily edited to automatically download any file from a link pointing to a file online.
;And lastly, the Different events and aliases I used to recreate the right click menu could be a great example or template for creating menus just like it.  To be clear, this is no ordinary menu event, this is for when the ordinary menu is gone or unusable.  I have grouped everything I used for the right click menu by a ;comment at the top and bottom to make it easy to figure out what was used.
;If you copy any part of this script please give due credit. Just a line above my code like ;"The following code was written by Typo @ http://www.hawkee.com/profile/44923" or something like that would be great.
;
;Usage: Type /ViewPic followed by a file name or /ViewPic alone for a file selection dialog or right cick in any window and select "Open picture" from the "Typos ViewPic" menu.
On *:Load:{ 
  if ($version < 6.3) { 
    noop $input(Sorry but this script requires mIRC 6.3 or higher to run.,o,ERROR 
    unload -rs $script
    return
  }
  if (!%ViewPicSaveDL) { set %ViewPicSaveDL no }
  if (!%ViewPicSavePath) { set %ViewPicSavePath $MircDir $+ ViewPic\ }
  if (!%ViewPicTimeout) { set %ViewPicTimeout 2 }
  if (!%ViewPicAlbumPath) { set %ViewPicAlbumPath $MircDir $+ ViewPic\ }
  if (!%ViewPicSlideShowDelay) { set %ViewPicSlideShowDelay 4 }
  mkdir " $+ $MircDir $+ ViewPic\ $+ "
  dialog $iif($Dialog(ViewPic),-ev,-md) ViewPic ViewPic 
}
alias ViewPic {
  if (!$1-) { 
    var %ViewPicFile $$sfile(%ViewPicLastPath $+ *.bmp,Select a picture.,OK) 
    set %ViewPicLastPath $nofile($qt(%ViewPicFile))
  }
  else { var %ViewPicFile $1- }
  if ($exists($qt(%ViewPicFile))) {  $iif($right(%ViewPicFile,4) == .gif,ViewPicAG,ViewPicAll) %ViewPicFile }
}
alias ViewPicAll {
  if (%ViewPicFailedLoad > 1) { ViewPicUnsetRunning }
  if (!%ViewPicInProgress) {
    set %ViewPicInProgress yes
    unset %ViewPicFailedLoad
    if ($gettok($1-,$0,32) == Downloaded) {
      var %ViewPicDownloaded = yes
      tokenize 32 $gettok($1-,1- $+ $calc($0 -1),32)    
    }
    if (!$1) {
      set %ViewPicFile $$sfile(%ViewPicLastPath $+ *.bmp,Select a picture.,OK) 
      set %ViewPicLastPath $nofile($qt(%ViewPicFile))
    }
    else { set %ViewPicFile $1- }
    if ($exists($qt(%ViewPicFile))) {
      if ($regex($right(%ViewPicFile,4),/\.?jpeg|jpg|gif|png|bmp/i)) && ($pic($qt(%ViewPicFile)).size) {
        set %ViewPicMode NormalScreen
        set %ViewPicTitle @ $+ $iif(%ViewPicDownloaded,$+($chr(164),Downloaded,$chr(164),$chr(160))) $+ Typos $+ $chr(160) $+ ViewPic
        var %ViewPicSW $window(-1).w, %ViewPicSH $window(-1).h, %ViewPicPW $pic($qt(%ViewPicFile)).width, %ViewPicPH $pic($qt(%ViewPicFile)).height, %ViewPicNW $round($calc($window(-1).w * .90),0), %ViewPicNH $round($calc($window(-1).h * .90),0), %ViewPicAspect $iif($pic($qt(%ViewPicFile)).width > $pic($qt(%ViewPicFile)).height,$v1 / $v2,$v2 / $v1)
        set %ViewPicWidth $round($iif(%ViewPicPW !> %ViewPicNW && %ViewPicPH !> %ViewPicNH,%ViewPicPW,$iif(%ViewPicPW > %ViewPicPH,$iif(%ViewPicPW > %ViewPicNW,%ViewPicNW,%ViewPicPW),$iif(%ViewPicPH > %ViewPicNH,$calc(%ViewPicNH / %ViewPicAspect),$calc(%ViewPicPH / %ViewPicAspect)))),0)
        set %ViewPicHeight $round($iif(%ViewPicPH !> %ViewPicNH && %ViewPicPW !> %ViewPicNW,%ViewPicPH,$iif(%ViewPicPH > %ViewPicPW,$iif(%ViewPicPH > %ViewPicNH,%ViewPicNH,%ViewPicPH),$iif(%ViewPicPW > %ViewPicNW,$calc(%ViewPicNW / %ViewPicAspect),$calc(%ViewPicPW / %ViewPicAspect)))),0)
        set %ViewPicSetWidth $round($iif(%ViewPicPW !> %ViewPicNW && %ViewPicPH !> %ViewPicNH,%ViewPicPW,$iif(%ViewPicPW > %ViewPicPH,$iif(%ViewPicPW > %ViewPicNW,%ViewPicNW,%ViewPicPW),$iif(%ViewPicPH > %ViewPicNH,$calc(%ViewPicNH / %ViewPicAspect),$calc(%ViewPicPH / %ViewPicAspect)))),0)
        set %ViewPicSetHeight $round($iif(%ViewPicPH !> %ViewPicNH && %ViewPicPW !> %ViewPicNW,%ViewPicPH,$iif(%ViewPicPH > %ViewPicPW,$iif(%ViewPicPH > %ViewPicNH,%ViewPicNH,%ViewPicPH),$iif(%ViewPicPW > %ViewPicNW,$calc(%ViewPicNW / %ViewPicAspect),$calc(%ViewPicPW / %ViewPicAspect)))),0)
        write -c ViewPicMenuFile.tmp <[Typos ViewPic Control Panel]>:dialog $!iif($Dialog(ViewPic),-evo,-mdo) ViewPic ViewPic
        write ViewPicMenuFile.tmp <[Switch to $!iif(%ViewPicMode == fullscreen,normal,$iif( $!window(%ViewPicTitle).dw != $!(%ViewPicSetWidth) || $!window(%ViewPicTitle).dh != $!(%ViewPicSetHeight),normal,fullscreen)) mode.]>:ViewPicModes %ViewPictitle
        write ViewPicMenuFile.tmp <[Save the current picture as...]>:ViewPicSaveAs $!(%ViewPicFile)
        write ViewPicMenuFile.tmp <[View the next picture]>:ViewPicScroll($!active).F
        write ViewPicMenuFile.tmp <[View the previous picture]>:ViewPicScroll($!active).B
        write ViewPicMenuFile.tmp <[Start a slideshow]>:viewpicslideshow $!active
        window -afdpk0Cow0 +l %ViewPicTitle -1 -1  %ViewPicWidth %ViewPicHeight ViewPicMenuFile.tmp mirc.exe 18
        titlebar %ViewPicTitle $nopath(%ViewPicFile)
        drawpic -ms %ViewPicTitle 0 0 %ViewPicWidth %ViewPicHeight 0 0 %ViewPicPW %ViewPicPH $qt(%ViewPicFile)
        .timerViewPicResize -m 0 10 if ( $!window(%ViewPicTitle) ) && ( $!window(%ViewPicTitle).dw != $!(%viewpicwidth) ) || ( $!window(%ViewPicTitle).dh != $!(%viewpicheight) ) if ( $!(%ViewPicMode) == NormalScreen) drawpic -ms $!(%ViewPicTitle) 0 0 $!window(%ViewPicTitle).dw $!window(%ViewPicTitle).dh 0 0 $!pic($qt(%ViewPicfile)).width $!pic($qt(%ViewPicFile)).height $!qt(%ViewPicFile) $chr(124) if ( $!window(%ViewPicTitle).dw != $!(%viewpicwidth) ) set %ViewPicWidth $!window(%ViewPicTitle).dw $chr(124) if ( $!window(%ViewPicTitle).dh != $!(%viewpicheight) ) set %ViewPicHeight $!window(%ViewPicTitle).dh
      }
      else {
        noop $input(That does not appear to be a supported image type.  /ViewPic supports .JPEG $+ $chr(44) .JPG $+ $chr(44) .BMP $+ $chr(44) .GIF and .PNG  Type /ViewPic Drive:\Path\To\File.ext to load a picture or type /ViewPic alone to use the file selection dialog.,o,Error!) 
        if (%viewpicscrolling) { $($!viewpicscroll($gettok(%viewpicscrolling,2-,32)). $+ $iif($gettok(%viewpicscrolling,1,32) == Forward,F),2) }
        else { ViewPicUnsetRunning }
      }
    }
    else {
      noop $input(Invalid Filename.  Type /ViewPic Drive:\Path\To\File.ext to load a picture or type /ViewPic alone to use the file selection dialog.,o,Error!) 
      if (%viewpicscrolling) { $($!viewpicscroll($gettok(%viewpicscrolling,2-,32)). $+ $iif($gettok(%viewpicscrolling,1,32) == Forward,F),2) }
      else { ViewPicUnsetRunning }
    }
  }
  else {
    noop $input(Typos ViewPic is already in use.  Please try again in a second or two. If this error comes up twice in a row the script will reset itself incase an error is preventing it from running.,o,Error!) 
    inc %ViewPicFailedLoad 1
  }
} 
alias ViewPicModes {
  var %ViewPicSW $window(-1).w, %ViewPicSH $window(-1).h, %ViewPicPW $pic($qt(%ViewPicFile)).width, %ViewPicPH $pic($qt(%ViewPicFile)).height, %ViewPicNW $round($calc($window(-1).w * .90),0), %ViewPicNH $round($calc($window(-1).h * .90),0), %ViewPicAspect $iif($pic($qt(%ViewPicFile)).width > $pic($qt(%ViewPicFile)).height,$v1 / $v2,$v2 / $v1), %ViewPicScreenAspect $iif($window(-1).w > $window(-1).h,$v1 / $v2,$v2 / $v1)
  var %ViewPicNSWidth $round($iif(%ViewPicPW !> %ViewPicNW && %ViewPicPH !> %ViewPicNH,%ViewPicPW,$iif(%ViewPicPW > %ViewPicPH,$iif(%ViewPicPW > %ViewPicNW,%ViewPicNW,%ViewPicPW),$iif(%ViewPicPH > %ViewPicNH,$calc(%ViewPicNH / %ViewPicAspect),$calc(%ViewPicPH / %ViewPicAspect)))),0)
  var %ViewPicNSHeight $round($iif(%ViewPicPH !> %ViewPicNH && %ViewPicPW !> %ViewPicNW,%ViewPicPH,$iif(%ViewPicPH > %ViewPicPW,$iif(%ViewPicPH > %ViewPicNH,%ViewPicNH,%ViewPicPH),$iif(%ViewPicPW > %ViewPicNW,$calc(%ViewPicNW / %ViewPicAspect),$calc(%ViewPicPW / %ViewPicAspect)))),0)
  if (zoom !isin %viewpicmode) { set %ViewPicMode $iif(%ViewPicMode == NormalScreen,$iif($window($1).dw != %ViewPicNSWidth || $window($1).dh != %ViewPicNSHeight,NormalScreen,FullScreen),NormalScreen) }
  var %ViewPicFSWidth $round($iif(%ViewPicAspect == %ViewPicScreenAspect && %ViewPicPW == %ViewPicSW,%ViewPicSW,$iif(%ViewPicAspect == 1,$iif(%ViewPicSW > %ViewPicSH,$v2,$v1),$iif(%ViewPicPW > %ViewPicPH,%ViewPicSW,$calc(%ViewPicSH / %ViewPicAspect)))),0)
  var %ViewPicFSHeight $round($iif(%ViewPicAspect == %ViewPicScreenAspect && %ViewPicPH == %ViewPicSH,%ViewPicSH,$iif(%ViewPicAspect == 1,$iif(%ViewPicSH > %ViewPicSW,$v2,$v1),$iif(%ViewPicPH > %ViewPicPW,%ViewPicSH,$calc(%ViewPicSW / %ViewPicAspect)))),0)
  window -c $1
  window -afdpk0Cow0 +l $+ $iif(%ViewPicMode == FullScreen,f) $1 -1 -1 $iif(%ViewPicMode == FullScreen,%ViewPicSW %ViewPicSH,%ViewPicNSWidth %ViewPicNSHeight) ViewPicMenuFile.tmp mirc.exe 18
  titlebar %ViewPicTitle $nopath(%ViewPicFile)
  drawfill $1 1 1 0 0 
  drawpic -ms $1 $iif(%viewpiczoom,$v1,$iif(%ViewPicPW == %ViewPicSW && %ViewPicPH == %ViewPicSH || %ViewPicMode == NormalScreen,1 1,$iif(%ViewPicAspect == 1 && %ViewPicSW > %ViewPicSH || %ViewPicPW < %ViewPicPH,$calc((%ViewPicSW * .5) - (%ViewPicFSWidth * .5)) 1,1 $calc((%ViewPicSH * .5) - (%ViewPicFSHeight * .5))))) $iif(Zoom isin %ViewPicMode,$calc(%ViewPicNSWidth * $iif(%viewpicmode == zoom,1.5,$iif($v1 == zoom2,2,2.5))) $calc(%ViewPicNSHeight * $iif(%viewpicmode == zoom,1.5,$iif($v1 == zoom2,2,2.5))),$iif(%ViewPicMode == NormalScreen,%ViewPicNSWidth %ViewPicNSHeight,%ViewPicFSWidth %ViewPicFSHeight)) 1 1 %ViewPicPW %ViewPicPH $qt(%ViewPicFile)
  unset %viewpiczoom
}
alias ViewPicAG {
  if (%ViewPicFailedLoad > 1) { ViewPicUnsetRunning }
  if (!%ViewPicInProgress) {
    unset %ViewPicFailedLoad
    set %ViewPicInProgress yes
    if ($gettok($1-,$0,32) == Downloaded) {
      var %ViewPicDownloaded = yes
      tokenize 32 $gettok($1-,1- $+ $calc($0 - 1),32)    
    }
    if (!$1) { 
      set %ViewPicFile $$sfile(%ViewPicLastPath $+ *.gif,Select a picture.,OK) 
      set %ViewPicLastPath $nofile($qt(%ViewPicFile))
    }
    else { set %ViewPicFile $1- }
    if ($exists($qt(%ViewPicFile))) && ($right(%ViewPicFile,4) == .gif) {
      if ($pic($qt(%ViewPicFile)).size) {
        write -c ViewPicMenuFile.tmp <[Typos ViewPic Control Panel]>:dialog $!iif($Dialog(ViewPic),-evo,-mdo) ViewPic ViewPic
        write ViewPicMenuFile.tmp <[Save the current picture as...]>:ViewPicSaveAs $qt(%ViewPicFile)
        write ViewPicMenuFile.tmp <[View the next picture]>:ViewPicScroll($!active).F
        write ViewPicMenuFile.tmp <[View the previous picture]>:ViewPicScroll($!active).B
        write ViewPicMenuFile.tmp <[Start a slideshow]>:viewpicslideshow $!active
        bread $qt(%ViewPicFile) 0 $file($qt(%ViewPicFile)).size &AniGif 
        var %AniGifSepPos $bfind(&AniGif, 0, 33 249 4), %AniGifDisposal $bvar(&AniGif,$calc(%AniGifSepPos + 3),1), %AniGifNamePre $left(%ViewPicFile,-4), %AniGifName $nopath(%AniGifNamepre), %AniGifDelayChars $bvar(&AniGif,$calc(%AniGifSepPos + 4),2)
        var %AniGifDelay $iif($calc($base($base($gettok(%AniGifDelayChars,2,32),10,16) $+ $base($gettok(%AniGifDelayChars,1,32),10,16),16,10) * 10) > 0,$v1,60), %AniGiflets 0
        if (!$bfind(&AniGif, $calc(%AniGifSepPos + 1), 33 249 4)) && (%AniGifSepPos != 0) || (%AniGifSepPos == 0) { 
          if ($isalias(ViewPicAll)) {
            unset %viewpicinprogress
            ViewPicAll %ViewPicFile $iif(%ViewPicDownloaded,Downloaded) 
          } 
          else { ViewPicAG2 %ViewPicFile $iif(%ViewPicDownloaded,Downloaded) }
          return  
        }
        if (%AniGifSepPos == 0) || (%AniGifDisposal == 5) || (%AniGifDisposal == 4) { 
          noop $input(This type of animated gif cannot be displayed due to limitations in mircs /drawpic command.  The first frame is being shown as a subsitute.,o,Error!) 
          if ($isalias(ViewPicAll)) { 
            unset %viewpicinprogress
            if (%viewpicscrolling) { $($!viewpicscroll($gettok(%viewpicscrolling,2-,32)). $+ $iif($gettok(%viewpicscrolling,1,32) == Forward,F),2) }
            else { ViewPicAll %ViewPicFile $iif(%ViewPicDownloaded,Downloaded) }
          } 
          elseif (%viewpicscrolling) { $($!viewpicscroll($gettok(%viewpicscrolling,2-,32)). $+ $iif($gettok(%viewpicscrolling,1,32) == Forward,F),2) }
          else { ViewPicAG2 %ViewPicFile $iif(%ViewPicDownloaded,Downloaded) }
          return
        }
        bwrite ViewPicGifHeader.tmp 0 $calc(%AniGifSepPos + 7) &AniGif
        while ($bfind(&AniGif, %AniGifSepPos, 33 249 4)) {
          var %AniGifSepPos $calc($v1 + 7), %AniGifSepPos [ $+ [ %AniGiflets ] ] $v1
          inc %AniGiflets
        }
        var %AniGifSepPos $+ %AniGiflets $file($qt(%ViewPicFile)).size, %AniGifFrames %AniGiflets, %AniGifSeg = 1
        while (%AniGifFrames > %AniGifSeg) {
          var %AniGifV1 %AniGifSepPos [ $+ [ %AniGifSeg ] ], %AniGifV2 %AniGifSepPos [ $+ [ $calc(%AniGifSeg + 1) ] ]
          bread $qt(%ViewPicFile) $calc(%AniGifV1 + 7) $calc(%AniGifV2 - (%AniGifV1 + 7)) &AniGiflet [ $+ [ %AniGifSeg ] ]
          bset &AniGiflet [ $+ [ %AniGifSeg ] ] $bvar(&AniGiflet [ $+ [ %AniGifSeg ] ],0) 59
          inc %AniGifSeg
        }
        var %AniGifFile 1
        while (%AniGiflets > %AniGifFile) {
          .copy -o ViewPicGifHeader.tmp $qt($+(%AniGifName,-Frame,%AniGifFile,.gif))
          bwrite $+(%AniGifName,-Frame,%AniGifFile,.gif) -1 -1 &AniGiflet [ $+ [ %AniGifFile ] ]
          inc %AniGifFile         
        }
        if ($exists(ViewPicGifHeader.tmp)) { .remove ViewPicGifHeader.tmp }
        set %ViewPicInProgress yes
        .timerViewPic -hm 0 %AniGifDelay ViewPicAG2 $+(%ViewPicFile,$chr(160),$calc(%AniGiflets - 1),$chr(160)) $iif(%ViewPicDownloaded,Downloaded)
      }
      else { 
        noop $input(That does not appear to be a supported GIF format or the file is corrupt. /ViewPicAG only supports GIF's. Type /ViewPicAG Drive:\Path\To\File.ext to load a picture or type /ViewPicAG alone to use the file selection dialog.,o,Error!) 
        if (%viewpicscrolling) { $($!viewpicscroll($gettok(%viewpicscrolling,2-,32)). $+ $iif($gettok(%viewpicscrolling,1,32) == Forward,F),2) }
        else { ViewPicUnsetRunning }
      }
    }
    else {
      noop $input(Invalid Filename.  Type /ViewPicAG Drive:\Path\To\File.ext to load a picture or type /ViewPicAG alone to use the file selection dialog.,o,Error!) 
      if (%viewpicscrolling) { $($!viewpicscroll($gettok(%viewpicscrolling,2-,32)). $+ $iif($gettok(%viewpicscrolling,1,32) == Forward,F),2) }
      else { ViewPicUnsetRunning }
    }
  }
  else {
    noop $input(Typos ViewPic is already in use.  Please try again in a second or two. If this error comes up twice in a row the script will reset itself incase an error is preventing it from running.,o,Error!) 
    inc %ViewPicFailedLoad 1
  }
}
alias ViewPicAG2 {
  if (!%AniGifCurrent) { set %AniGifCurrent 1 }
  var %AniGifFile $gettok($1-,1,160), %AniGifFrames $gettok($1-,2,160), %AniGifSW $window(-1).w, %AniGifSH $window(-1).h, %AniGifPW $pic($qt(%AniGifFile)).width, %AniGifPH $pic($qt(%AniGifFile)).height, %AniGifNW $round($calc($window(-1).w * .90),0), %AniGifNH $round($calc($window(-1).h * .90),0), %AniGifAspect $iif($pic($qt(%AniGifFile)).width > $pic($qt(%AniGifFile)).height,$v1 / $v2,$v2 / $v1)
  var %ViewPicTitle @ $+ $iif(($gettok($1-,$0,32) == Downloaded),$+($chr(164),Downloaded,$chr(164),$chr(160))) $+ Typos $+ $chr(160) $+ ViewPic, %FramesNames $left(%AniGifFile,-4) $+ -Frame $+ %AniGifCurrent $+ $right(%AniGifFile,4)
  var %AniGifWidth $round($iif(%AniGifPW !> %AniGifNW && %AniGifPH !> %AniGifNH,%AniGifPW,$iif(%AniGifPW > %AniGifPH,$iif(%AniGifPW > %AniGifNW,%AniGifNW,%AniGifPW),$iif(%AniGifPH > %AniGifNH,$calc(%AniGifNH / %AniGifAspect),$calc(%AniGifPH / %AniGifAspect)))),0)
  var %AniGifHeight $round($iif(%AniGifPH !> %AniGifNH && %AniGifPW !> %AniGifNW,%AniGifPH,$iif(%AniGifPH > %AniGifPW,$iif(%AniGifPH > %AniGifNH,%AniGifNH,%AniGifPH),$iif(%AniGifPW > %AniGifNW,$calc(%AniGifNW / %AniGifAspect),$calc(%AniGifPW / %AniGifAspect)))),0)
  if (!$window(%ViewPicTitle)) { window -afdpk0Cow0 +lt %ViewPicTitle  -1 -1 %AniGifWidth %AniGifHeight ViewPicMenuFile.tmp mirc.exe 18 }
  drawpic -cms %ViewPicTitle 1 1 %AniGifWidth %AniGifHeight 1 1 %AniGifPW %AniGifPH $qt($iif(!%AniGifFrames,%AniGifFile,$gettok(%FramesNames,$numtok(%FramesNames,92),92)))
  titlebar %ViewPicTitle $nopath(%ViewPicFile)
  if (%AniGifFrames > %AniGifCurrent) { inc %AniGifCurrent }
  else { set %AniGifCurrent 1 }
}
alias viewpicslideshow {
  $viewpicscroll(Typos $+ $chr(160) $+ ViewPic).F
  .timerviewpicslideshow 0 %viewpicslideshowdelay $!viewpicscroll(Typos $+ $chr(160) $+ ViewPic).F
}
alias ViewPicScroll {
  if ($window(@ViewPicScroll)) { window -c $v1 }
  window -hw0 @ViewPicScroll
  noop $findfile($nofile($qt($iif(%viewpicfile,$v1,%ViewPicSavePath))),*.jpg;*.bmp;*.png;*.gif;*.jpeg,0,1,aline @ViewPicScroll $nopath($1-))
  filter -uwwct 0 32 @ViewPicScroll @ViewPicScroll *
  if ($window(@Typos $+ $chr(160) $+ ViewPic)) { window -c $v1 }
  elseif ($window($+(@,$chr(164),Downloaded,$chr(164),$chr(160),Typos,$chr(160),ViewPic))) { window -c $v1 }
  var %viewpicfiletmp %ViewPicFile
  viewpicclosing $1 reopen
  if ($window(@Typos $+ $chr(160) $+ ViewPic)) { window -c $v1 }
  if ($window($+(@,$chr(164),Downloaded,$chr(164),$chr(160),Typos,$chr(160),ViewPic))) { window -c $v1 }
  set %ViewPicScrolling $iif($prop == f,Forward,Backward) $1-
  ViewPic $nofile($iif(%viewpicfiletmp,$v1,%viewpicsavepath)) $+ $line(@ViewPicScroll,$iif(!$nopath(%viewpicfiletmp) || $calc($fline(@ViewPicScroll,$nopath(%ViewPicFiletmp)) $iif($prop == F,+,-) 1) > $line(@ViewPicScroll,0),1,$iif($v1 <= 0,$line(@ViewPicScroll,0),$v1))))
  window -c @ViewPicScroll 
}
on *:keydown:*:*:{ 
  if (*Typos $+ $chr(160) $+ ViewPic* iswm $target) {
    if ($timer(viewpicslideshow)) {
      .timerviewpicslideshow off
      return
    }
    if ($keyval == 33) || ($keyval == 37) || ($keyval == 189) { $ViewPicScroll($active).B }
    elseif ($keyval == 34) || ($keyval == 39) || ($keyval == 187) { $ViewPicScroll($active).F }
    elseif (!$timer(TyposViewPic)) && (%ViewPicMode) {
      if (zoom isin %viewpicmode) { set %viewpicmode %normalscreen }
      ViewPicModes $target 
    } 
  } 
}
on *:open:@:{ if (*Typos $+ $chr(160) $+ ViewPic* iswm $target) { .timerViewPicTimeOut off } }
on *:close:@:{ viewpicclosing $target }
alias viewpicclosing {
  if (*Typos $+ $chr(160) $+ ViewPic* iswm $1-) {
    if ($timer(viewpicslideshow).com) { var %viewpicslidetmp $v1 }
    .timerViewPic* off
    if ($2) && (%viewpicslidetmp) { .timerviewpicslideshow 0 %viewpicslideshowdelay $v1 }
    var %CurrentDelete = 1
    if ($exists(ViewPicDLFile.tmp)) { .remove ViewPicDLFile.tmp }
    if ($exists(ViewPicMenuFile.tmp)) { .remove ViewPicMenuFile.tmp }
    if (* $+ $chr(164) $+ Downloaded $+ $chr(164) $+ * iswm $target) && ($exists($qt(%ViewPicFile))) { .remove $qt(%ViewPicFile) }
    while ($exists($qt($left($nopath(%ViewPicFile),-4) $+ -Frame $+ %CurrentDelete $+ $right(%ViewPicFile,4)))) {
      .remove $qt($left($nopath(%ViewPicFile),-4) $+ -Frame $+ %CurrentDelete $+ $right(%ViewPicFile,4))
      inc %CurrentDelete
    }
    unset %ViewPicFile %ViewPicIncoming* %ViewPicInProgress %ViewPicWebURL %AniGifCurrent %ViewPicMode %ViewPicTitle %ViewPicWidth %ViewPicHeight %ViewPicSetWidth %ViewPicSetHeight
  }
}
alias ViewPicDownloader {
  if (%ViewPicFailedLoad > 1) { ViewPicUnsetRunning }
  if (!%ViewPicInProgress) {
    unset %ViewPicFailedLoad
    set %ViewPicInProgress yes
    if ($left($1,4) == http) { set %ViewPicWebURL $right($1,- $+ $calc($pos($1,://,1) + 2)) }
    else { set %ViewPicWebURL $1 }
    if ($exists($nopath(%ViewPicWebURL))) { 
      if ($exists(OldCopyOf $+ $nopath(%ViewPicWebURL))) { .remove $nopath(%ViewPicWebURL) }
      else { .rename $nopath(%ViewPicWebURL) OldCopyOf $+ $nopath(%ViewPicWebURL) }
    }
    if ($exists(ViewPicDLFile.tmp)) { .remove ViewPicDLFile.tmp }
    if (!$window(@ViewPicProgress)) { window -fdpk0Cow0 +fl @ViewPicProgress -1 -1 100 10 }
    drawtext @ViewPicProgress 4 Verdana 10 49 -1 0%
    sockopen ViewPic $gettok(%ViewPicWebURL,1,47) 80
  }
  else {
    noop $input(Typos ViewPic is already in use.  Please try again in a second or two. If this error comes up twice in a row the script will reset itself incase an error is preventing it from running.,o,Error!) 
    inc %ViewPicFailedLoad 1
  }
}
on *:sockopen:ViewPic:{
  if (!$sockerr) {
    sockwrite -nt $sockname GET / $+ $gettok(%ViewPicWebURL,2-,47) HTTP/1.0
    sockwrite -nt $sockname Host: $gettok(%ViewPicWebURL,1,47)
    sockwrite -n $sockname Cookie: PHPSESSID="";Path="" 
    sockwrite -n $sockname Accept-Ranges: bytes
    sockwrite -n $sockname Accept: */* 
    sockwrite -n $sockname Connection: close 
    sockwrite -n $sockname $crlf
    unset %viewpicsockseconds
    unset %viewpicsockrcvd
    .timerViewPicTimeOut -m 0 2000 ViewPicTimeOut $Ticks $!Ticks $!sock(ViewPic).rcvd
  }
  else { 
    ViewPicUnsetRunning
    .timer 1 0 noop $!input(Nothing to view! HTTP error!,o,Error!)
  }
}
on *:sockread:ViewPic:{
  if (%ViewPicIncomingCount >= 2) {
    var %ViewPicPercentDL $iif($iif($calc($sock($sockname).rcvd - %ViewPicProgressStartBytes) == %ViewPicDLSize,100,$left($gettok($calc(($sock($sockname).rcvd - %ViewPicProgressStartBytes) / %ViewPicDLSize),2,46),2)) == $null,0,$v1)
    sockread -f &ViewPicIncoming
    if ($sockbr == 0) { return }
    if (!$window(@ViewPicProgress)) { window -fdpk0Cow0 +fl @ViewPicProgress -1 -1 100 10 }
    drawrect -f @ViewPicProgress 0 0 %ViewPicPercentDL 0 $calc(100 - %ViewPicPercentDL) 10
    drawrect -f @ViewPicProgress 12 12 0 0 %ViewPicPercentDL 10
    drawtext @ViewPicProgress 4 Verdana 10 %ViewPicPercentDL -1 %ViewPicPercentDL $+ %
    bwrite ViewPicDLFile.tmp -1 -1 &ViewPicIncoming
  }
  else {
    sockread %ViewPicIncoming
    if ($sockbr == 0) { return }
    if (Content-Length: isin %ViewPicIncoming) { set  %ViewPicDLSize $gettok(%ViewPicIncoming,2,32) }
    if (*404 Not Found* iswm %ViewPicIncoming) || (*403 Forbidden* iswm %ViewPicIncoming) {
      .timer 1 0 noop $!input(Nothing to view! HTTP 403/404 error!,o,Error!)
      sockclose $sockname
      unset %ViewPicIncoming* %ViewPicInProgress  %ViewPicWebURL
      return
    }
    if (!%ViewPicIncoming) && (%ViewPicIncomingCount == 1) { 
      set %ViewPicProgressStartBytes $sock($sockname).rcvd
      inc %ViewPicIncomingCount 
    } 
    if (Content-Length: isin %ViewPicIncoming) { inc %ViewPicIncomingCount }
  } 
}
on *:sockclose:ViewPic:{ 
  if ($window(@ViewPicProgress)) { window -c $v1 }
  .timerviewpictimeout off
  if ($exists(ViewPicDLFile.tmp)) && (%ViewPicWebURL) {
    var %OriginalName $nopath(%ViewPicWebURL)
    if (%viewpicsavedl == yes) { .copy -o ViewPicDLFile.tmp $qt(%ViewPicSavePath $+ %OriginalName) }
    .rename ViewPicDLFile.tmp $qt(%OriginalName)
    if (!$pic($qt(%OriginalName)).size) {
      .timer 1 0 noop $!input(Nothing to view! Download error!,o,Error!)
      ViewPicUnsetRunning 
    }
    else {
      .timerViewPicSockClose 1 0 $iif($right(%OriginalName,4) == .gif,ViewPicAG,ViewPicAll) $mircdir $+ %OriginalName Downloaded
      unset %viewpicincoming* %viewpicdlsize %viewpicprogressstartbytes %viewpicpercentdl %ViewPicInProgress
    }
  }
  else { 
    .timer 1 0 noop $!input(Nothing to view! Download error!,o,Error!)
    ViewPicUnsetRunning 
  }
  unset %viewpicincoming* %viewpicdlsize %viewpicprogressstartbytes %viewpicpercentdl %viewpicsockrcvd %viewpicsockseconds
}
alias ViewPicTimeOut {
  if ($window(@ViewPicProgress)) {
    if (%ViewPicSockSeconds) {
      if ($calc($3 - $gettok(%ViewPicSockRcvd,1,32)) <= 300) || ($calc($2 - $1) >= $calc(%ViewPicTimeout * 60 * 1000)) {
        ViewPicUnsetRunning
        noop $input(The Download has timed out.,o,Error!)
      }
    }
    inc %ViewPicSockSeconds
    set %ViewPicSockRcvd $sock(ViewPic).Rcvd $ticks
  }
  else { 
    unset %ViewPicSockRcvd
    unset %viewpicsockseconds
    .timerViewPicTimeOut off 
  }
}
alias ViewPicUnsetRunning {
  unset %ViewPicFile %ViewPicTitle %ViewPicWidth %ViewPicHeight %ViewPicInProgress %ViewPicMode %ViewPicWebURL %viewpicincoming* %viewpicdlsize %viewpicprogressstartbytes %viewpicpercentdl %AniGif* %ViewPicSetWidth %ViewPicSetHeight %ViewPicSockRcvd %viewpicsockseconds
  .timerViewPic* off
  if ($sock(ViewPic)) { sockclose $v1 }
  if ($window(@Typos $+ $chr(160) $+ ViewPic)) { window -c $v1 }
  if ($window($+(@,$chr(164),Downloaded,$chr(164),$chr(160),Typos,$chr(160),ViewPic))) { window -c $v1 }
  if ($window(@ViewPicRightClick)) { window -c $v1 }
  if ($window(@ViewPicProgress)) { window -c $v1 }
  if ($exists(ViewPicDLFile.tmp)) { .remove ViewPicDLFile.tmp }
  if ($exists(ViewPicMenuFile.tmp)) { .remove ViewPicMenuFile.tmp }
  if ($exists(ViewPicGifHeader.tmp)) { .remove ViewPicGifHeader.tmp }
}
alias ViewPicSaveAs {
  var %ViewPicSaveAsFolder $sdir(%viewpicsavepath,Select the folder to save the new copy to.), %ViewPicSaveAsName $input(Select a name for the new copy.  You do not need to include a file extension or path $+ $chr(44) $+ just a name.,e,Ok), %ViewPicSaveAs $+(",%ViewPicSaveAsFolder,%ViewPicSaveAsName,.,$gettok($1-,$numtok($1-,46),46),")
  if ($exists(%ViewPicSaveAs)) { noop $input(Sorry but that file already exists.  Please try again.,o,Error!) }
  elseif (%ViewPicSaveAsName) { copy $1- %ViewPicSaveAs }
}
dialog ViewPic {
  title "Typos ViewPic"
  size -1 -1 82 146
  option dbu
  box "", 1, 2 19 78 15
  check "Save Downloaded Photos.", 2, 5 23 73 10
  button "Done", 3, 26 132 30 10, default ok cancel
  box "", 6, 2 0 78 20
  button "Change Folder.", 7, 21 40 41 10
  box "", 8, 2 33 78 32
  edit "", 10, 3 52 76 10, read autohs
  box "", 11, 0 -3 82 149
  text "Select Whether or not to save the downloaded pictures.", 4, 4 4 74 14, center
  box "", 12, 2 96 78 33
  text "Set the download timeout in minutes.", 13, 4 101 74 14, center
  combo 14, 29 116 24 10, drop
  box "", 15, 2 64 78 33
  text "Set the time between pictures in seconds for the slideshow.", 16, 4 69 74 14, center
  combo 17, 29 84 24 10, drop
}
On *:Dialog:ViewPic:init:0:{ 
  if (%ViewPicSaveDL == yes) { did -c ViewPic 2 }
  did -ra ViewPic 10 $iif(%ViewPicSavePath,$v1,No path selected) 
  var %tonums 1, %ssnum 1
  while (%ssnum < 16) {
    did -a ViewPic 17 %ssnum
    inc %ssnum
  }
  if (%ViewPicSlideShowDelay) { did -c ViewPic 17 %ViewPicSlideShowDelay } 
  else { did -c ViewPic 17 3 }
  while (%tonums < 11) {
    did -a ViewPic 14 %tonums
    inc %tonums 
  }
  if (%ViewPicTimeout) { did -c ViewPic 14 %ViewPicTimeout } 
  else { did -c ViewPic 14 2 }
}
On *:Dialog:ViewPic:SClick:*:{
  if ($did == 3) {
    set %ViewPicSaveDL $iif($did(2).state == 1,yes,no) 
    if {$did(14).sel != %ViewPicTimeout) { set %ViewPicTimeout $did(14).sel }
    if {$did(17).sel != %ViewPicSlideShowDelay) { set %ViewPicSlideShowDelay $did(17).sel }
  } 
  if ($did == 7) {
    var %tmpvpdir $sdir(*.* $+ $chr(44) $+ Select a directory for the downloaded photos.)
    if ($isdir(%tmpvpdir)) {
      set %ViewPicSavePath %tmpvpdir
    }
    did -ra ViewPic 10 $iif(%ViewPicSavePath,$v1,No path selected)
  }
}
dialog ViewPicAlbum {
  title "ViewPic Album"
  size -1 -1 175 285
  option dbu
  button "Done", 1, 77 271 21 10, default ok
  button "Last Page", 2, 4 231 31 10
  button "Next Page", 3, 139 231 31 10
  text "Use the 'Next page' and 'Last page' buttons to change the page and double click any photo to view it or single click to selected for deletion.", 4, 3 2 170 14, center
  box "", 5, 1 -2 173 20
  box "", 9, 134 53 36 39
  box "", 8, 91 53 36 39
  box "", 7, 48 53 36 39
  box "", 6, 5 53 36 39
  icon 24, 6 59 33 29
  icon 25, 49 59 33 29
  icon 26, 92 59 33 29
  icon 27, 135 59 33 29
  box "", 13, 134 97 36 39
  box "", 12, 91 97 36 39
  box "", 11, 48 97 36 39
  box "", 10, 5 97 36 39
  icon 28, 6 103 33 29
  icon 29, 49 103 33 29
  icon 30, 92 103 33 29
  icon 31, 135 103 33 29
  box "", 17, 134 141 36 39
  box "", 16, 91 141 36 39
  box "", 15, 48 141 36 39
  box "", 14, 5 141 36 39
  icon 32, 6 147 33 29
  icon 33, 49 147 33 29
  icon 34, 92 147 33 29
  icon 35, 135 147 33 29
  box "", 21, 134 185 36 39
  box "", 20, 91 185 36 39
  box "", 19, 48 185 36 39
  box "", 18, 5 185 36 39
  icon 36, 6 191 33 29
  icon 37, 49 191 33 29
  icon 38, 92 191 33 29
  icon 39, 135 191 33 29
  box "", 22, 1 49 173 179
  box "", 23, 0 -2 175 286
  box "", 41, 4 52 38 41
  box "", 42, 3 51 40 43
  box "", 43, 2 50 42 45
  box "", 44, 45 50 42 45
  box "", 45, 46 51 40 43
  box "", 46, 47 52 38 41
  box "", 47, 88 50 42 45
  box "", 48, 89 51 40 43
  box "", 49, 90 52 38 41
  box "", 50, 131 50 42 45
  box "", 51, 132 51 40 43
  box "", 52, 133 52 38 41
  box "", 64, 133 96 38 41
  box "", 63, 132 95 40 43
  box "", 62, 131 94 42 45
  box "", 61, 90 96 38 41
  box "", 60, 89 95 40 43
  box "", 59, 88 94 42 45
  box "", 58, 47 96 38 41
  box "", 57, 46 95 40 43
  box "", 56, 45 94 42 45
  box "", 55, 2 94 42 45
  box "", 54, 3 95 40 43
  box "", 53, 4 96 38 41
  box "", 76, 133 140 38 41
  box "", 75, 132 139 40 43
  box "", 74, 131 138 42 45
  box "", 73, 90 140 38 41
  box "", 72, 89 139 40 43
  box "", 71, 88 138 42 45
  box "", 70, 47 140 38 41
  box "", 69, 46 139 40 43
  box "", 68, 45 138 42 45
  box "", 67, 2 138 42 45
  box "", 66, 3 139 40 43
  box "", 65, 4 140 38 41
  box "", 88, 133 184 38 41
  box "", 87, 132 183 40 43
  box "", 86, 131 182 42 45
  box "", 85, 90 184 38 41
  box "", 84, 89 183 40 43
  box "", 83, 88 182 42 45
  box "", 82, 47 184 38 41
  box "", 81, 46 183 40 43
  box "", 80, 45 182 42 45
  box "", 79, 3 183 40 43
  box "", 78, 4 184 38 41
  box "", 77, 2 182 42 45
  button "Permanently Delete", 89, 60 257 55 10
  box "", 90, 1 241 173 28
  edit "Single click a picture to select it.", 92, 40 246 95 10, read autohs center
  button "Change the current folder", 93, 7 39 68 10
  box "", 94, 1 16 173 35
  edit "", 95, 7 27 160 10, read autohs center
  text "Currently viewing:", 96, 63 20 49 7, center
  box "", 97, 1 226 173 17
  button "Open the current folder", 98, 99 39 68 10
  button "Start a slideshow", 40, 64 231 47 10
}
on *:dialog:ViewPicAlbum:init:0:{ 
  unset %ViewPicAlbumPlace
  did -h viewpicalbum 6-21,41-88
  viewpicscrollalbum
  did -a viewpicalbum 95 %viewpicalbumpath
}
On *:dialog:ViewPicAlbum:dclick:24-39:{ viewpic $line(@viewpicscrollalbum,$calc((%ViewPicAlbumPlace - 16) + ($did - 24))) }
On *:dialog:ViewPicAlbum:sclick:0,2-3,24-40,89,93,98:{ 
  if ($did == 40) { viewpicslideshow }
  if ($did == 98) { run %viewpicalbumpath }
  if ($did == 89) && ($did(viewpicalbum,92) != Single click a picture to select it.) { 
    dialog -n viewpicalbum viewpicalbum
    if ($input(Are you sure you wish to delete $did(viewpicalbum,92),y,Delete file?)) {
      remove -b $qt(%viewpicalbumpath $+ $did(viewpicalbum,92))
      dialog -oev viewpicalbum viewpicalbum
      did -h viewpicalbum 6-21,41-88
      set %viewpicalbumplace $calc(%viewpicalbumplace - 16)
      did -ra viewpicalbum 92 Single click a picture to select it.
      viewpicscrollalbum
    }
    dialog -oev viewpicalbum viewpicalbum
  }
  if ($did == 93) {
    dialog -n viewpicalbum viewpicalbum
    if ($$sdir(%ViewPicSavePath)) { 
      set %ViewPicAlbumPath $v1
      set %ViewPicAlbumPlace 1
      did -h viewpicalbum 6-21,41-88
      did -r viewpicalbum 92,95
      did -a viewpicalbum 95 %ViewPicAlbumPath 
      viewpicscrollalbum
    }
    dialog -oev viewpicalbum viewpicalbum
  }
  if ($did isnum 2-3) { 
    did -h viewpicalbum 6-21,41-88
    viewpicscrollalbum $iif($did == 2,last) 
  } 
  if ($did == 0) || ($did isnum 24-39) {
    if ($inrect($mouse.x,$mouse.y,10,106,72,78)) { var %ViewPicSelected 6 }
    if ($inrect($mouse.x,$mouse.y,96,106,72,78)) { var %ViewPicSelected 7 }
    if ($inrect($mouse.x,$mouse.y,182,106,72,78)) { var %ViewPicSelected 8 }
    if ($inrect($mouse.x,$mouse.y,268,106,72,78)) { var %ViewPicSelected 9 }
    if ($inrect($mouse.x,$mouse.y,10,194,72,78)) { var %ViewPicSelected 10 }
    if ($inrect($mouse.x,$mouse.y,96,194,72,78)) { var %ViewPicSelected 11 }
    if ($inrect($mouse.x,$mouse.y,182,194,72,78)) { var %ViewPicSelected 12 }
    if ($inrect($mouse.x,$mouse.y,268,194,72,78)) { var %ViewPicSelected 13 }
    if ($inrect($mouse.x,$mouse.y,10,282,72,78)) { var %ViewPicSelected 14 }
    if ($inrect($mouse.x,$mouse.y,96,282,72,78)) { var %ViewPicSelected 15 }
    if ($inrect($mouse.x,$mouse.y,182,282,72,78)) { var %ViewPicSelected 16 }
    if ($inrect($mouse.x,$mouse.y,268,282,72,78)) { var %ViewPicSelected 17 }
    if ($inrect($mouse.x,$mouse.y,10,370,72,78)) { var %ViewPicSelected 18 }
    if ($inrect($mouse.x,$mouse.y,96,370,72,78)) { var %ViewPicSelected 19 }
    if ($inrect($mouse.x,$mouse.y,182,370,72,78)) { var %ViewPicSelected 20 }
    if ($inrect($mouse.x,$mouse.y,268,370,72,78)) { var %ViewPicSelected 21 }
    if (%ViewPicSelected)  {
      did -ra viewpicalbum 92 $nopath($line(@viewpicscrollalbum,$calc((%ViewPicAlbumPlace - 16) + (%ViewPicSelected - 6))))
      did -h viewpicalbum 6-21,41-88
      did -v viewpicalbum %ViewPicSelected $+ , $+ $calc(((%ViewPicSelected - 6) * 3) + 41) $+ - $+ $calc(((%ViewPicSelected - 6) * 3) + 43)
    }
  }
}
On Dialog:ViewPicAlbum:close:0:{
  if ($window(@ViewPicScrollAlbum)) { window -c $v1 }
  unset %viewpicalbumplace
}
alias ViewPicScrollAlbum {
  did -h viewpicalbum 24-39
  ViewPicFileList
  if ($line(@ViewPicScrollAlbum,0)) {
    var %ViewPicAlbumNum 1
    if ($1 == Last) { set %ViewPicAlbumPlace $iif($calc(%ViewPicAlbumPlace - 32) <= 0,$iif(16 // $line(@viewpicscrollalbum,0),$calc(($floor($calc($v2 / 16)) * 16) - 15),$calc(($floor($calc($v2 / 16)) * 16) + 1)),$calc(%ViewPicAlbumPlace - 32)) }
    if (!%ViewPicAlbumPlace) || (%ViewPicAlbumPlace > $line(@ViewPicScrollAlbum,0)) { set %ViewPicAlbumPlace 1 }
    while (%ViewPicAlbumNum < 17) {
      if (%ViewPicAlbumPlace <= $line(@ViewPicScrollAlbum,0)) && ($pic($line(@ViewPicScrollAlbum,%ViewPicAlbumPlace)).size) {
        did -g viewpicalbum $calc(%ViewPicAlbumNum + 23) $qt($line(@ViewPicScrollAlbum,%ViewPicAlbumPlace)) 
        var %viewpicalbumfilled $addtok(%viewpicalbumfilled,$calc(%ViewPicAlbumNum + 23),44)
      }
      inc %ViewPicAlbumNum
      inc %ViewPicAlbumPlace
    }
    did -v viewpicalbum %viewpicalbumfilled
  }
  else { 
    dialog -n viewpicalbum viewpicalbum
    noop $input(There are no pictures in the currently selected folder.,o,Nothing to view!) 
    dialog -oev viewpicalbum viewpicalbum

  }
}
alias ViewPicFileList {
  if ($window(@ViewPicScrollAlbum)) { window -c $v1 }
  window -hw0 @ViewPicScrollAlbum
  noop $findfile($qt(%ViewPicAlbumPath),*.jpg;*.bmp;*.png;*.gif;*.jpeg,0,1,aline @ViewPicScrollAlbum $1-)
  filter -uwwct 0 32 @ViewPicScrollAlbum @ViewPicScrollAlbum *
}
on $*:hotlink:/((?:https?://|www\d?\.).*\.(?:jpg|png|gif|bmp|jpeg)$)/i:*:{
  if ($mouse.key & 1) { ViewPicDownloader $regml(1) } 
  halt 
}
;Begin everything needed for the Right Click Menu.
on $^*:hotlink:/((?:https?://|www\d?\.).*\.(?:jpg|png|gif|bmp|jpeg)$)/i:*:{ 
  if ($mouse.key & 16) { 
    ViewPicRightClick $mouse.dx $mouse.dy
    set -e %ViewPicRightClickURL $regml(1)
  }
}
alias ViewPicRightClick {
  if ($2) {
    if ($window(@ViewPicRightClick)) { window -c @ViewPicRightClick }
    if (!$timer(ViewPicRightClick)) { .timerViewPicRightClick -oh 0 10 $!iif($mouse.win == @ViewPicRightClick,$iif($mouse.y isnum 0-13,ViewPicRightClickline 1,$iif($mouse.y isnum 20-33,ViewPicRightClickline 2,$iif($mouse.y isnum 40-53,ViewPicRightClickline 3)))) }
    window -dBpow0 +feL @ViewPicRightClick $1 $calc($2 - 31) 192 62
    drawfill -r @ViewPicRightClick 13882323 13882323 0 0 
    drawtext @ViewPicRightClick 1 Verdana 11 0 0 $str($chr(160),13) $+ Copy address
    drawline -r @ViewPicRightClick 8421504 1 2 17 184 17 
    drawline @ViewPicRightClick 0 1 2 18 184 18 
    drawtext @ViewPicRightClick 1 Verdana 11 0 20 $str($chr(160),2) $+ Open in new browser window
    drawline -r @ViewPicRightClick 8421504 1 2 37 184 37 
    drawline @ViewPicRightClick 0 1 2 38 184 38 
    drawtext @ViewPicRightClick 1 Verdana 11 0 40 $chr(160) $+ Open in active browser window
  }
}
Alias ViewPicRightClickLine {
  if ($1 isnum 1-3) {
    var %rclines = 1
    while (%rclines < 4) {
      drawreplace -r @ViewPicRightClick $iif(%rclines == $1,13882323 7346457,7346457 13882323) 0 $iif(%rclines == 1,1,$iif(%rclines == 2,21,$iif(%rclines == 3,41))) 192 13
      drawreplace @ViewPicRightClick $iif(%rclines == $1,1 0,0 1) 0 $iif(%rclines == 1,1,$iif(%rclines == 2,22,$iif(%rclines == 3,41))) 192 13
      inc %rclines
    }
  }
}
alias ViewPicRightClickDone {
  .timerViewPicRightClick off
  window -c @ViewPicRightClick
  unset %ViewPicRightClickURL
}
On *:Active:*:{ if ($lactive == @ViewPicRightClick) { ViewPicRightClickDone } }
On *:AppActive:{ if ($window(@ViewPicRightClick)) { ViewPicRightClickDone } }
Menu * {
  rclick:{ if (*Typos $+ $chr(160) $+ ViewPic* iswm $mouse.win) && (!%anigifcurrent) && ($timer(viewpicslideshow)) { .timerviewpicslideshow off } }
  sclick:{
    if (*Typos $+ $chr(160) $+ ViewPic* iswm $mouse.win) && (!%anigifcurrent) {
      if ($timer(viewpicslideshow)) {
        .timerviewpicslideshow off
        return
      }
      if (%viewpicmode != zoom3) { set %viewpiczoom - $+ $calc($mouse.x * $iif(%viewpicmode == zoom,1,$iif($v1 == zoom2,1.5,.5))) - $+ $calc($mouse.y * $iif(%viewpicmode == zoom,1,$iif($v1 == zoom2,1.5,.5))) }
      set %viewpicmode $iif(%viewpicmode == fullscreen,fullscreen,$iif(%viewpicmode == zoom,zoom2,$iif($v1 == zoom2,zoom3,$iif($v1 == zoom3,fullscreen,zoom))))
      ViewPicModes $mouse.win
    }
    if ($mouse.win == @ViewPicRightClick) {
      if ($mouse.y isnum 1-12) {
        clipboard %ViewPicRightClickURL
        ViewPicRightClickDone
      }
      elseif ($mouse.y isnum 22-33) {
        url -an %ViewPicRightClickURL
        ViewPicRightClickDone
      }
      elseif ($mouse.y isnum 41-52) {
        url %ViewPicRightClickURL
        ViewPicRightClickDone
      }
    }
  }
  -
  <[Typos ViewPic]>
  .Open a Picture:ViewPic
  .Open the photo album:dialog $iif($Dialog(ViewPicalbum),-evo,-mdo) ViewPicAlbum ViewPicAlbum 
  .Start a slideshow:{ viewpicslideshow } 
  .Control Panel:dialog $iif($Dialog(ViewPic),-ev,-md) ViewPic ViewPic
  -
}
;End everything needed for the Right Click Menu. The dclick and the <[Typos ViwPic]> section is not needed for the custom right click menu.
On *:UnLoad:{
  ViewPicUnsetRunning
  unset %ViewPic* 
}
;End Typos ViewPic 

Comments

Sign in to comment.
FiB3R   -  Jul 15, 2009

Great script, thank you.

I have a multi monitor setup, and choose to have my channel windows on the desktop rather than within mIRC, and I keep the main mIRC window minimised most of the time.

Would it be possible in a future revision, that when clicking on an image link, the image opens on the same screen as the channel window? And perhaps more importantly (to me at least) that it ignores the window transparency settings?

Slightly transparent windows can look pretty cool on a dark background when it's only text, but it totally ruins an image.

Thanks again :)

 Respond  
Hawkee   -  Mar 07, 2009

I'm not sure why, but I'm getting the following error when I try to view the next or previous picture:

VIEWPICSCROLL($!ACTIVE).F Unknown command

I'm running mIRC 6.35 on Win XP.

 Respond  
CharltonJ   -  Dec 25, 2008

wow, nice :D

 Respond  
^Neptune   -  Dec 09, 2008

Still can't connect to your server Typo o_O

 Respond  
Typo   -  Dec 09, 2008

I wanted to apologize to anyone waiting for the release of the next update which adds online image searching abilities. Things got really busy for me the past couple months and I haven't had time for any kind of coding till past few days. I will resume the testing for the update very soon and then release it if it's good to go.

Sorry for the delays.

 Respond  
Typo   -  Oct 04, 2008

Thanks a lot a careful warchild.

Watch soon for my next update that adds online image searching capabilities. It's currently in the testing phase.

Thanks for the comment tho, I'm glad you like it.

Blitz, I believe I already addressed that issue in the next upddate but if it still happens after the image search addition please let me know so I can fix it.

Thanks for the comment.

 Respond  
Blitzjager   -  Oct 04, 2008

Not a big deal but sometimes when I get a download error the download % bar stays up for a few secs.

 Respond  
a careful warchild   -  Oct 04, 2008

well, i have tested, and read through the intro, my only critism was 1 typo in the intro ;) which i told you about in PM, other than that amazing. Typo you never cease to amaze me :P, definetly 10/10 and +1 like, im sure i will be using this alott :P

 Respond  
Typo   -  Sep 22, 2008

So, I'm pretty sure I'm going to use http://www.picsearch.com for the image search idea unless someone can give me a great reason not to.

The site is perfect in every way for getting information from using sockets and I personally like the search results.

The results are always different than google or yahoo because they have their own search engine and they filter out all the porn pretty well so the results are nice and clean and family friendly.

I will be starting on this idea tomorrow so if anyone has any other ideas for sites to use or any good reason for me not to use the one I picked than now is the time to mention it.

Thanks.

 Respond  
Typo   -  Sep 22, 2008

Great idea. I'm going to think on it, like where to have it look and how to handle the results and so on.

Thanks for the idea!

 Respond  
EL   -  Sep 22, 2008

Workin good typo nice job.Maybe add searching i cant remember if it doesn cause i unlaoded it with the rest of my test script from all yew fukin hawkeer's;p but i ll have to load it up and use it and im to damn lazy to scrol up to see the features but if not searchin for pix would be cool.`-.-´

 Respond  
Typo   -  Sep 21, 2008

Thank you very much mountaindew. :)

EL noticed a problem with the new zoom feature in todays update that made it offset the picture a little bit when returning to normal view on the fourth click. I have fixed that now and updated the code. Thanks EL.

 Respond  
guest598594   -  Sep 21, 2008

This is really nice Typo, I give it a 10/10 :)

 Respond  
Typo   -  Sep 21, 2008

Thanks for the comment and yes I am still considering a name change but I am having a difficult time deciding what to change it to if I do so it was not included with this new update. It's a tuff decision. I will bring the list of names back down to the bottom of the comments pretty soon since its getting pretty far up. For now tho I would rather people notice the new update I just uploaded.

 Respond  
Blitzjager   -  Sep 21, 2008

This looks great! Can't wait to try it. (Or break it. :3)
I'm not sure if you're still changing the name but I'd go with TypoPhoto or Typo's Picture Manager.

 Respond  
Typo   -  Sep 21, 2008

New update adds zooming and a slideshow feature!

Updated 9/21/2008

  1. Added the ability to zoom in by left clicking on the image. Wherever you click is where it will center the zoomed image. The first click will zoom to 1.5x, the second click zooms to 2x, the third click zooms to 2.5x and the click after that will return you to the normal view. Pressing any other key at any time during the zoom process will also return the view to normal.
  2. Added a slideshow feature. You can select "Start a slideshow" from any of the rightclick menus and also by using the slideshow button in the photo album. To stop the slideshow simply hit any key or click with the mouse. The delay between photos is adjustable in the viewpic control panel and defaults at 4 seconds.
    ...If you run the slideshow when a picture is not loaded it will default to the viewpic's save folder which is set in the control panel. If you start it by right clicking on a picture it will use the folder of the currently loaded picture and using the button in the photo album will start a slideshow in the whichever folder the photo album is in.
  3. Fixed an error with the aspect ratio in the full screen view which went undiscovered until now due to the small amount of affected photos.
  4. Various other smaller bug fixes and coding updates.

I was going to add support to set the current image as the background in mirc and infact had added it to the script with a nice dialog of its own with all available options but there was problems.
It seems to act funny when setting backgrounds in a large amount of windows/channels. If too many channels are open the backgrounds start acting up by actually dissapearing and even worse it would no longer allow the viewpic script or the viewpic photo album to load images properly so I decided to not support the option at all and removed all the 100+ lines of code I had added when adding the feature.

Like always, if you have any problems or any comments for future updates feal free to comment.

 Respond  
^Neptune   -  Sep 09, 2008

I think the first 5 or so names are too long imo.

Typo's Picture Center/Manager would be good because you could then expand it to upload images to a site, or do many other things with the images.

 Respond  
Eugenio   -  Sep 08, 2008

/me rolls
nah bruv

 Respond  
EL   -  Sep 08, 2008

Or or Typos Super Image Epic Win Manager;o

 Respond  
Eugenio   -  Sep 08, 2008

Yeah thats not a bad idea since its not too long and that does describe the code tbh

 Respond  
EL   -  Sep 08, 2008

Ill go with Typos Image Center;p.`-.-´

 Respond  
Typo   -  Sep 08, 2008

Every one of my scripts are titled like that. It's just how I've always done it and I really don't see any reason to change it. Would you ask Microsoft to drop the word Microsoft from all of their titles? We may call if Office but its Microsoft Office. Same with Adobe or Macromedia, every application titles start with their name.

I know Typos isn't a company name but it serves the same purpose which is to make my stuff stand apart and be easily identifiable. When you see a tite starting with Typos there is no doubt who made it. Someone who likes my stuff can easily find more and someone that hates me can easily avoid it.

Sorry if it bothers you but it's something I won't be changing.

Keep the name ideas coming tho. The newest suggestion is Typos Image Center.

 Respond  
Eugenio   -  Sep 08, 2008

I was gonna say that too
the reason why I changed my second last comment to Picture Viewer and Photo Album

 Respond  
Jonesy44   -  Sep 08, 2008

Can you try and get rid of saying "Typo" everywhere. im sure your proud! but it gets soo annoying when people advertise kinda..

 Respond  
Typo   -  Sep 07, 2008

Ok, for the renaming. I'm making a list of possible names so people can get some ideas or say what they like, even if it's the current name.

We have the current name:
[size=18]Typos ViewPic[/size]

The current list for new names is:
[size=16]Typos Picture Viewer and Photo Album[/size]
[size=16]Typos Picture Viewer and Album[/size]
[size=16]Typos Image Viewer and Album[/size]
[size=16]Typos Picture Manager[/size]
[size=16]Typos ViewPic and Album[/size]
[size=16]TypoPhoto[/size]
[size=16]Typos Photo Center[/size]
[size=16]Typos Pic Viewer[/size] aka [size=16]TP-Viewer[/size]
[size=16]Typos Image Center[/size]
[size=16]Typos ViewPix[/size]
[size=16]Typos Picture Center[/size]

Try to keep in mind I want the name to try and describe that it can view photos and that it has an album but I'm open to anything.

p.s. For anyone that is unaware, an update was released for this script on 09/06/2008 so if you havent grabbed it be sure to do that.

 Respond  
xplo   -  Sep 07, 2008

/me Suggest -> Tp-viewer

stands for Typo's Pic Viewer

 Respond  
Hawkee   -  Sep 07, 2008

How about TypoPhoto.

 Respond  
Typo   -  Sep 07, 2008

Eugene noticed that the timeout issue was still periodically happening even with the new timeout scheme updates so I asked for his help to find out why he was having the issue and we finally figured it out with some creative echoing.

I came up with a fix and have uploaded it but this problem affected only toe people as far as i know so if you weren't having any issues with downloads ther is no need to update if you already have the last update from 09/06/2008 .

XploreR, I'm not sure why my script would cause any lags but I'm glad your enjoying it.

Thanks for idea and name suggestion neptune. Ill look into a zoom feature and see how doable it is since your not the first to ask.

Keep the name ideas and any other suggestions coming everyone.

 Respond  
Eugenio   -  Sep 07, 2008

@Neptune
stop riping my ideas, I suggested that AGES ago wtf ;o
/me infuriates

 Respond  
xplo   -  Sep 07, 2008

my script is lagging as hell since i got this remote in it, but this is nice work.

10/10

 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.