da questo script vorrei che al posto di scaricare il file da web a directory, il file me lo mandasse al mio NICK dove si deve modificare?Ho messo $nick al posto di $dir e ora me lo scarica direttamente nella directory download del mirc..mi sa che bisogna cambiare altro...:
;***********************************
;mIRC File Downloader v1.0
;Scripted by Phoenix_the_II
;Phoenix_the_II@sjacob.dk
;Do not modify/recreate/distribute unless giving permission by me
;Usage: /download <URL> <Destanation Directory>
;***********************************
dialog download {
title "mIRC File Downloader v1.0 by Phoenix_the_II"
size -1 -1 170 73
option dbu
text "", 1, 5 3 106 8
text "", 2, 62 33 76 8
text "Speed:", 3, 5 33 54 8
text "", 4, 113 3 25 8
button "Open Dir", 5, 139 13 30 10
button "Open File", 6, 139 26 30 10
button "Cancel", 7, 139 39 30 10, cancel
text "", 8, 62 23 76 8
text "Estimated Time Left:", 9, 5 23 54 8
text "Filesize:", 10, 5 13 54 8
text "", 11, 62 13 76 8
text "Status:", 12, 5 43 25 8
text "", 13, 62 43 76 8
text "URL:", 14, 5 53 12 8
text "", 15, 40 53 140 8
text "Destination:", 16, 5 63 36 8
text "", 17, 40 63 116 8, nowrap
}
on *:dialog:download:init:0: {
did -ra download 15 $iif($len(%fullhost) > 45,$left(%fullhost,45) $+ ...,%fullhost)
did -ra download 17 $iif($len(%path $+ %nopath) > 45,$left(%path $+ %nopath,45) $+ ...,%path $+ %nopath)
did -ra download 13 Initializing...
did -ra download 2 0kB/sec
did -ra download 8 0secs
did -ra download 11 0byte/0byte
did -ra download 4 0%
did -ra download 1 [::::::::::::::::::::::::::::::::::::::::::::::::::]
did -b download 6
}
on *:dialog:download:sclick:5: {
run %path
}
on *:dialog:download:sclick:6: {
if ($exists(%path $+ %nopath)) {
run $+(",%path,%nopath,") | url $+(",file://,%path,%nopath,")
}
}
on *:sockopen:download: {
if ($sockerr < 0) { error Download Failed,wo,Error }
set %download 0
set %ticks $ticks
sockwrite -n $sockname GET $+($iif(%dir != $null,/ $+ %dir),/,%nopath2) HTTP/1.1
sockwrite -n $sockname Accept-Language: en-us
sockwrite -n $sockname Connection: keep-alive
sockwrite -n $sockname User-Agent: Mozilla/??
sockwrite -n $sockname Host: %host
sockwrite $sockname $crlf
}
alias update {
set %1 $calc($file(%path $+ %nopath).size - %fsize)
set %2 $calc($ticks - %dticks)
if (%2 == 0) { set %2 1000 }
set %3 $calc((%1 / %2) * 1000)
set %4 $calc((%size - $file(%path $+ %nopath).size) / %3)
set %dticks $ticks
set %fsize $file(%path $+ %nopath).size
$iif($dialog(download),did -ra download 8 $duration($round(%4,0)))
$iif($dialog(download),did -ra download 2 $iif(%3 != 0,$iif(%3 >= 1000,$iif(%3 >= 1000000,$round($calc(%3 /1024 /1024),1) $+ MB/sec,$round($calc(%3 /1024),1) $+ kB/sec),$round(%3,1) $+ B/sec)))
}
on *:sockread:download: {
if (!$dialog(download)) { .timerstat off | .timerdownload off | sockclose $sockname | Error Download closed file not saved,wo,Error | $iif($exists(%path $+ %nopath),remove %path $+ %nopath) | halt }
if (%download == 0) {
sockread %data
if (404 not found isin %data) { sockclose $sockname | error 404 file not found,wo,Error | dialog -c download download | halt }
if (content-length isin %data) {
set %size $remove($gettok(%data,2,58),$chr(32))
$iif(!$dialog(download),did -ra download 11 $iif($file(%nopath).size >= 1000,$iif($file(%nopath).size >= 1000000,$round($calc($file(%nopath).size /1024 /1024),3) $+ MB,$round($calc($file(%nopath).size /1024),3) $+ kB),$file(%nopath).size $+ bytes) $+ / $+ $iif(%size >= 1000,$iif(%size >= 1000000,$round($calc(%size /1024 /1024),3) $+ MB,$round($calc(%size /1024),3) $+ kB),%size $+ bytes))
if ($disk(%left(%path,1)).free < %size) {
error Not enough free space available on $left(%path,1) $+ : $crlf $+ Space needed $iif(%size >= 1000,$iif(%size >= 1000000,$round($calc(%size /1024 /1024),3) $+ MB,$round($calc(%size /1024),3) $+ kB),%size $+ bytes) $+ $crlf $+ Space to clear up: $iif($calc(%size - $disk($left(%path,1)).free) >= 1000,$iif($calc(%size - $disk($left(%path,1)).free) >= 1000000,$round($calc($calc(%size - $disk($left(%path,1)).free) /1024 /1024),3) $+ MB,$round($calc($calc(%size - $disk($left(%path,1)).free) /1024),3) $+ kB),$calc(%size - $disk($left(%path,1)).free) $+ bytes)) ,wo,Error
writeini -n downloader.ini %nopath status Not enough harddisk space
writeini -n downloader.ini %nopath date $fulldate
writeini -n downloader.ini %nopath size %size
dialog -c download download
sockclose $sockname
halt
}
}
if ($len(%data) < 4) {
inc %download
.timerstat 0 1 update
}
}
elseif (%download == 1) {
sockread 8192 &bin
bwrite " $+ %path $+ %nopath $+ " -1 &bin
$iif($dialog(download),did -ra download 13 Downloading...)
.timerdownload 1 10 $iif($dialog(download),did -ra download 13 Stalled...)
set %percent $round($calc($file(%path $+ %nopath).size / %size * 100),0)
set %i 1
set %bar $eval([,0)
while (%i <= 50) {
if ($calc(%percent / 2) < %i) {
set %bar %bar $+ :
}
elseif ($calc(%percent / 2) >= %i) {
set %bar %bar $+ |
}
if (%i == 50) {
set %bar %bar $+ $eval(],0)
}
inc %i
}
$iif($dialog(download),did -ra download 1 %bar)
$iif($dialog(download),did -ra download 4 %percent $+ $chr(37))
if (%size == $null) { set %size $file(%path $+ %nopath).size | $iif($dialog(download),did -e download 6) }
if ($file(%path $+ %nopath).size >= %size) { .timerstat off
$iif($dialog(download),did -ra download 4 100%)
set %size $file(%path $+ %nopath).size
.timerdownload off
$iif($dialog(download),did -e download 6)
$iif($dialog(download),did -ra download 7 Exit)
$iif($dialog(download),did -ra download 13 Download Completed)
$iif($dialog(download),did -ra download 8 0secs)
$iif($dialog(download),did -ra download 3 Avarage Speed![]()
$iif($dialog(download),did -ra download 2 $round($calc(%size / (($ticks / 1000) - (%ticks / 1000)) / 1024),1) $+ kB/sec)
.timerdownload1 1 1 error Download completed: File saved in %path ,io,^_^
writeini -n downloader.ini %nopath status Download Completed
writeini -n downloader.ini %nopath date $fulldate
writeini -n downloader.ini %nopath speed $round($calc(%size / (($ticks / 1000) - (%ticks / 1000)) / 1024),1) $+ kB/sec)
}
$iif($dialog(download),did -ra download 11 $iif($file(%path $+ %nopath).size >= 1000,$iif($file(%path $+ %nopath).size >= 1000000,$round($calc($file(%path $+ %nopath).size /1024 /1024),3) $+ MB,$round($calc($file(%path $+ %nopath).size /1024),3) $+ kB),$file(%path $+ %nopath).size $+ bytes) $+ / $+ $iif(%size >= 1000,$iif(%size >= 1000000,$round($calc(%size /1024 /1024),3) $+ MB,$round($calc(%size /1024),3) $+ kB),%size $+ bytes))
}
}
on *:dialog:download:close:0: {
sockclose download
if ($did(13).text != Download Completed) {
writeini -n downloader.ini %nopath status Download closed by user
writeini -n downloader.ini %nopath date $fulldate
Error Download closed file not saved,wo,Error
$iif($exists(%path $+ %nopath),remove %path $+ %nopath)
.timerstat off
.timerdownload off
halt
}
}
alias error {
if (!$isid) { tokenize 44 $1- }
set %input $input($1,$2,$3)
}
alias download {
unset %path
if ($1) {
if (ftp:// isin $1) { error You can't download files from ftp servers yet!,wo,Error| halt }
if (http:// !isin $1) { Error Please give a full path to download including http://,wo,Error | halt }
if ($2) {
if ($right($2-,1) != \) { Error Please give a full destination path including the "\",wo,Error | halt }
else {
set %path $2-
if ($disk($left(%path,1)).type == cdrom) { Error You cant save your file directly on a CD-ROM drive!,wo,Error | halt }
elseif ($disk($left(%path,1)).type != fixed) { Error Drive does not exists,wo,Error | halt }
}
}
elseif (!$2) {
set %path $mircdir $+ download\
}
set %fullhost $1
set %nopath $mkfn($nopath($1))
set %nopath2 $nopath($1)
if (%nopath == $null) { Error No file specified,wo,Error | halt }
set %host $gettok($nofile($1),2,47)
if (%host == $null) { set %host / }
set %dir $gettok($nofile($1),$+(3-,$numtok($1,47)),47)
sockclose download
set %port
set %i 1
while (%i <= 5) {
if ($mid($gettok(%fullhost,3,58),%i,1) isnum) {
set %port %port $+ $mid($gettok(%fullhost,3,58),%i,1)
}
inc %i
}
if (!$exists(%path)) {
error %path Doesn't exists!! Want to create it?,qnv,Question
if (%input == $yes) {
mkdir %path
}
elseif (%input == $no) {
:dir
var %mkdir $sdir(c:\,Please select directory to save to)
if ($disk($left(%mkdir,1)).type == cdrom) { error You cant save your file directly on a CD-ROM drive!,wo,Error | goto dir }
if (%mkdir != $null) {
if ($disk($left(%mkdir,1)).type == $null) { error Drive does not exsist!,wo,Error | goto dir }
}
else { sockclose download | error No download directory given,wo,Aborted | $iif($dialog(download),dialog -c download download) | halt }
if (%mkdir != $null) {
mkdir %mkdir
set %path %mkdir
}
else { sockclose download | error No download directory given,wo,Aborted | $iif($dialog(download),dialog -c download download) | halt }
}
}
:file
if ($exists(%path $+ %nopath)) {
error %path $+ %nopath already exists! Remove and begin writing new file?,qy,Question
if (%input == $true) {
remove %path $+ %nopath
}
else { sockclose download | error File already exists,wo,Aborted | $iif($dialog(download),dialog -c download download) | halt }
}
unset %size
sockopen download $iif(%port != $null,$remove(%host,: $+ %port),%host) $iif(%port != $Null,%port,80)
writeini -n downloader.ini %nopath URL %fullhost
writeini -n downloader.ini %nopath begin $fulldate
writeini -n downloader.ini %nopath path %path $+ %nopath
dialog -m download download
}
else { echo -a Usage: /download <URL> <Destanation dir> Example: /download http://www.mirc-help.de/mirc/mirc603.exe c:\ }
}
;--------------------------
;Download History
;Usage /history
;its that easy!
;--------------------------
dialog history {
title "Please select download history file"
size -1 -1 120 30
option dbu
combo 1, 5 5 100 80, sort,drop
button "&Select" 2, 5 18 30 10, flat
button "&Close" 3, 43 18 30 10, flat,ok
}
on *:dialog:history:init:0: {
did -t history 2
var %tini $ini(downloader.ini,0)
var %i 1
while (%i <= %tini) {
did -a history 1 $ini(downloader.ini,%i)
inc %i
}
}