tglogo.png

Downloading File

Filename: $Extract
; Script: Extract.mrc
; Author: SReject
; Version: v1.0
; Contact: SReject on   irc.undernet.org:6667 (#mIRCScripting)
;                  on     irc.dalnet.org:6667 (#helpdesk)
;                  on   irc.SwiftIRC.net:6667 (#mSL)
;                  on irc.Entropyirc.Net:6667 (#Help)
;          Email @ [email protected]
;
;
;
; Over View:
;   This snippet allows you to extract .zip files from within mIRC. If successful "1" is returned,
;   if not, "0" is.
;
;
:
; To Load:
;   save file in your mIRC directory as Extract.mrc
;   Type in any mIRC editbox: /load -rs Extract.mrc
;
; To Unload:
;   Type in any mIRC Editbox: /unload -rs Extract.mrc
;
;
;
; To Use:
;
;   The format is $extract(Path\File.zip,Directory).show
;
;   Path\File.zip (Required)
;     This is the full path to the zip file you want to extract
;
;   Directory (Optional)
;     This is the full path to the directory inwhich you wish to extract the .zip file. If it doesn't
;     exist, it will be created. If not specified, then the files are extracted to the .zip's parent folder\zip filename\
;
;   .Show (Optional)
;     if you specify the .Show prop, then after the files are extracted, the directory inwhich the files were extracted
;     will be opened for your viewing.
;



alias Extract {
  if (!$isid || $0 > 2 || *.zip" !iswm $qt($1) || !$exists($1) || ($prop && $Prop != show)) { return 0 }

  var %from = $qt($1), %to = $iif($0 == 1 || !$2,$qt($regsubex($noqt(%from),/\.zip$/i,)),$qt($2)), %r, %a = $&
    Set FSO = CreateObject("Scripting.FileSystemObject") $lf $&
    set S = CreateObject("Shell.Application") $lf $&
    set F = S.NameSpace( $+ %From $+ ).items $lf $&
    S.NameSpace( $+ %To $+ ).CopyHere(F)

  if ($com(Extract)) { goto error }
  if (!$isdir(%to)) {
    if ($isdir($mircdir $+ $noqt(%to))) { %to = $qt($mircdir $+ $noqt(%to)) }
    else { mkdir %to }  
  }

  .comopen Extract MSScriptControl.ScriptControl
  if ($comerr) { goto error }

  var %r = $calc($com(Extract,language,4,bstr*,vbscript) + $com(Extract,executestatement,1,bstr*,%a))
  if ($comerr) { goto error }

  if ($prop == show) { run %to }

  :error
  if ($com(Extract)) { .comclose Extract }
  return $iif($error || $comerr || %r != 2,0,1)
}

Related Files


Please note that on our website we use cookies necessary for the functioning of our website, cookies that optimize the performance. To learn more about our cookies, how we use them and their benefits, please read our Cookie Policy.
I Understand