home *** CD-ROM | disk | FTP | other *** search
/ napalm.napnet.hu / 2015-02-12.napalm.napnet.hu.tar / napalm.napnet.hu / programok / kommunikacio / mpp700.exe / sample-mUnzip.mrc < prev    next >
Text File  |  2002-04-05  |  3KB  |  101 lines

  1. ; mUnzip sample
  2.  
  3. alias -l unzdll return $+(", $scriptdir, mUnzip.dll")
  4.  
  5. on *:LOAD:{
  6.   var %echo
  7.   if ($version < 6) { %echo = Please use mIRC 6.0 or greater. }
  8.   elseif (!$isfile($unzdll)) { %echo = This sample will only work if you put mUnzip.dll on its directory. }
  9.   else { %echo = To run the sample, type '/unzsample'. }
  10.   echo $color(info) -eati2 *** %echo
  11. }
  12. on *:UNLOAD:dll -u $unzdll | unset %unzsample.file
  13.  
  14. alias unzsample {
  15.   if ($version < 6) { echo $color(info) -ati2 *** Please use mIRC 6.0 or greater. | return }
  16.   var %d = unzsample, %file
  17.   if (!$isfile($unzdll)) { echo $color(info) -ati2 *** mUnzip.dll was not found. | return }
  18.   if ($dialog(%d)) { dialog -v %d }
  19.   else {
  20.     if (*.zip iswm $longfn($1-)) && ($isfile($1-)) { %file = $1- }
  21.     else {
  22.       var %dir = $nofile($findfile($mircdir, *.zip, 1))
  23.       if (!%dir) { %dir = $mircdir }
  24.       %file = $sfile(%dir $+ *.zip, Open zip file)
  25.       if (!$isfile(%file)) { return }
  26.     }
  27.     if ($chr(32) isin %file) && ("*" !iswm %file) { %file = $+(", %file, ") }
  28.     %unzsample.file = %file
  29.     dialog -m %d %d
  30.   }
  31. }
  32.  
  33. dialog -l unzsample {
  34.   title "Extract zip file"
  35.   size -1 -1 107 144
  36.   option dbu
  37.   text "Archive contents:", 1, 3 3 43 7
  38.   list 2, 3 12 101 68, sort size vsbar
  39.   text "Archive comments:", 3, 3 84 46 7
  40.   edit "", 4, 3 93 101 24, read multi autohs vsbar
  41.   text "", 5, 3 120 100 7, nowrap
  42.   button "Extract", 2901, 21 130 40 10, default ok
  43.   button "Close", 2902, 63 130 40 10, cancel
  44. }
  45. on *:DIALOG:unzsample:init:0:{
  46.   var %file = %unzsample.file
  47.   if (!$isfile(%file)) { unzsample_fail | return }
  48.   if (S_OK* !iswm $dll($unzdll, Unzip, -vS sample %file .)) { unzsample_fail }
  49.   if (S_OK* !iswm $dll($unzdll, Unzip, -zS sample %file .)) { unzsample_fail }
  50. }
  51. on *:DIALOG:unzsample:sclick:2901:{
  52.   var %dir = $sdir($mircdir, Select the target folder)
  53.   if (!$isdir(%dir)) { halt }
  54.   if (S_OK* !iswm $dll($unzdll, Unzip, -Sd sample %unzsample.file %dir)) { beep }
  55.   unset %unzsample.file
  56. }
  57. on *:DIALOG:unzsample:sclick:2902:unset %unzsample.file
  58.  
  59. alias -l unzsample_fail {
  60.   beep
  61.   dialog -x unzsample
  62.   unset %unzsample.file
  63. }
  64.  
  65. on *:SIGNAL:mUnzip_sample:{
  66.   if (!$dialog(unzsample)) { return }
  67.   if ($1 == list) {
  68.     var %file = $gettok($2-, 1, 124)
  69.     ; if it's not a directory, add it
  70.     if (*\ !iswm %file) { did -a unzsample 2 %file }
  71.   }
  72.   elseif ($1 == comment) { did -a unzsample 4 $iif($did(unzsample, 4), $crlf) $+ $2- }
  73.   elseif ($1 == replace) {
  74.     %unzsample.repfile = $2-
  75.     dll $unzdll Reply $dialog(unzsample_replace, unzsample_replace, -4)
  76.     unset %unzsample.repfile
  77.   }
  78.   elseif ($1 == echo) {
  79.     if ($2-4 == Target file exists.) { tokenize 32 $1 $5- }
  80.     did -o unzsample 5 1 $2-
  81.   }
  82. }
  83.  
  84.  
  85. dialog -l unzsample_replace {
  86.   title "File conflict"
  87.   size -1 -1 148 40
  88.   option dbu
  89.   text "The following file already exists. Replace it?", 1, 3 3 105 7
  90.   text %unzsample.repfile, 2, 9 15 130 7, nowrap
  91.   text "", 2900, 0 0 0 0, result
  92.   button "&Yes", 3, 3 27 34 10
  93.   button "&No", 4, 39 27 34 10, cancel
  94.   button "Y&es to all", 5, 75 27 34 10
  95.   button "N&o to all", 6, 111 27 34 10
  96.   button "", 7, 0 0 0 0, hide default ok
  97. }
  98. on *:DIALOG:unzsample_replace:init:0:did -f $dname 4
  99. ; a reply for "no" isn't needed
  100. on *:DIALOG:unzsample_replace:sclick:3,5,6:did -o $dname 2900 1 $gettok(yes.~.yes all.no all, $calc($did - 2), 46) | dialog -k $dname
  101.