mIRC Homepage
Posted By: Massacre DCC: Rename before accept - 14/07/03 10:21 PM
I'm currently working on a script that manages downloads from multiple DCC bots on multiple chans on multiple networks etc... my problem is, some bots have the same file under a different name. If i were to dload 100mb of afile.exe off bot1, then resume off bot2 who was calling it a_file.exe, is there a way i could change the name back to afile.exe, so that it resumes, not starts again @ the new file name?
Posted By: Othello Re: DCC: Rename before accept - 14/07/03 11:06 PM
This is a script I wrote to unzip zip files, rename the files, move a file, and delete the file from my download folder.
now this is set for text and zip files. if the script recieves a text. It should be no problem renaming a file if you know what you want to remove out of the file name.


on *:FILERCVD:*: {
if .txt isin $filename {
set %rcvname $replace($nick,|,_) $+ .txt
if ( $exists($+(List\,%rcvname)) == $true ) { .remove $+(",List\,%rcvname,") }
.rename $filename $+(",list\,%rcvname,")
$upcnt
halt
}
if .zip isin $filename {
set %rcvname $nick $+ .txt
set %rcvzip $replace($nopath($filename),.zip,.txt)
if ( $exists($+(List\,%rcvname)) == $true ) { .remove $+(",List\,%rcvname,") }
//echo -s $dll(mUnzip.dll, Unzip, $filename "List\")
.remove $filename
.rename $+(",List\,%rcvzip,") $+(",List\,%rcvname,")
$upcnt
halt
}
}
Posted By: pheonix Re: DCC: Rename before accept - 14/07/03 11:08 PM
on *:DCCSERVER:GET:{
.rename " $+ $1- $+ " $replace($1-,_,$chr(32))
}
Posted By: Om3n Re: DCC: Rename before accept - 15/07/03 11:03 AM
I believe in the example they used it would be $remove($1-,_)
as the replace proc you used would mean the filename would still be different.
Posted By: pheonix Re: DCC: Rename before accept - 15/07/03 01:03 PM
here's an example.
you receive
mirc_FAQ from someone,if you $remove _ it wud be mircFAQ if you replace _ with a space it would be mirc FAQ.
Posted By: saragani Re: DCC: Rename before accept - 15/07/03 01:17 PM
You can also make the files to be saved in directories named after the bots names.

I had a script which does that, and it is working gr8.
Posted By: Massacre Re: DCC: Rename before accept - 16/07/03 05:18 PM
But don't they all rename the files after the file has been received? I need to change the save location before it has been downloaded so mirc resumes to the right file, not starts another.
Posted By: Online Re: DCC: Rename before accept - 16/07/03 06:48 PM
Well you can manually rename the file at the dcc get dialog, but I fail to see how this is scriptable. What you can do however is renaming the partially-downloaded afile.exe to a_file.exe as the ctcp event arrives, and that will make mirc to resume the download.
Code:
ctcp *:dcc send *:?:{
  if $nopath($filename) == a_file.exe && $isfile($getdirafile.exe) {
    rename " $+ $getdirafile.exe" " $+ $getdira_file.exe"
  }
}
© mIRC Discussion Forums