mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Aug 2003
Posts: 14
M
MrZebra Offline OP
Pikka bird
OP Offline
Pikka bird
M
Joined: Aug 2003
Posts: 14
Hi all,

Ok, you know how when you go to mIRC's dcc options, u can select the option to have it pop up the get dialog if the file exists? Then when u get a file, the get dialog pops up and then if u want to, you can accept the file, but rename it, so that if someone sends u file.ext , you can save it as file(1).ext ?

Ok, so how would I go about scripting this? I dont' want to have to be at my computer when the get dialog pops up, but I still want to be able to rename the files. Now, yes , i do know that I could download the file to a temp directory, then rename it after it completes, and move it back to the main directory. But I really wanted to avoid moving files after download. Also, I just want to do what mIRC will do, only automate it.

I've been trying to use ctcp events, but I can't figure out, when you get the dcc send file ip port size, how you are supposed to respond to get the file, or to get the file and rename it.

Any ideas??? I'd be soo appreciative smile
Thanks.

Z

Joined: Dec 2002
Posts: 2,809
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 2,809
I don't believe this can be done.

Joined: Dec 2002
Posts: 774
T
Hoopy frood
Offline
Hoopy frood
T
Joined: Dec 2002
Posts: 774
download it to download dir and rename it there?


Code:
//if ( khaled isgod ) echo yes | else echo no
Joined: Aug 2003
Posts: 14
M
MrZebra Offline OP
Pikka bird
OP Offline
Pikka bird
M
Joined: Aug 2003
Posts: 14
Well...in response to post #1. Yeah I'm beginning to think it is impossible, unfortunately...

In response to post #2. Well I know I could download to temp directory and rename it after...but I wan't to avoid moving the files around and such after download. and I can't download it to the download directory if the file already exists :|..
Thus why I"m trying to find a way, using ctcp's possibly, to just do what mIRC's get dialog will do, rename first and download...
Z

Joined: Jun 2003
Posts: 67
D
Babel fish
Offline
Babel fish
D
Joined: Jun 2003
Posts: 67
its not possible to rename the incoming file but u can rename the previous file recieved
Code:
on 1:DCCSERVER:Send:{
  if ($exists($findfile(C:,$1-,1) == $true) {
    var %file = $findfile(C:,$1-,1)
    var %ext = $right(%file,4)
    var %file2 = $remove(%file,%ext) $+ (1) $+ %ext
    rename %file %file2
  }
}


while (demi == nub) {
inc %skill
}
Joined: Dec 2002
Posts: 417
O
Fjord artisan
Offline
Fjord artisan
O
Joined: Dec 2002
Posts: 417
I have a simple script that auto renames a text to the nicks name.txt maybe its somethign you can play around with
now if you are monitoring your downloads you might be able to insert a $$?="Enter New FileName" into the script. Now this
script has not been tested.


on *:FILERCVD:*: {
var %gfile = $nopath($filename)
if ( $exists($+($getdir\,%gfile)) == $true ) {
.rename $filename $+(",$getdir\,$$?="Enter New FileName",")
.remove $+(",$getdir\,%gfile,")
halt
}
}


This is the original script

on *:FILERCVD:*: {
var %setfile = $nopath($filename)
var %getnick = $+($replace($nick,|,!),.txt)
if (( .txt isin %setfile ) && ( $nick isin %setfile )) {
if ( $exists($+(%ldir,%getnick)) == $true ) { .remove $+(",%ldir,%getnick,") }
.rename $filename $+(",%ldir,%getnick,")
halt
}
}





Intelligence: It's better to ask a stupid question, then to prove it by not asking....
Joined: Aug 2003
Posts: 14
M
MrZebra Offline OP
Pikka bird
OP Offline
Pikka bird
M
Joined: Aug 2003
Posts: 14
"its not possible to rename the incoming file but u can rename the previous file recieved"

well..maybe I phrased that wrong... but mIRC's get dialog can do it. You can choose the option to "save file as" and name it anything you want before the file even starts to download...
which is the basis of what I'm trying to do...

So I was trying to find the ctcp commands to connect to the sender's port and download the file...but as I stated, I'm beginning to think that it's impossible to imitate what mIRC's built in get dialog will do unfortunately...

So I'll probably HAVE to end up dealing with either renaming the exising file, or downloading the new file to a temp dir, renaming it, and moving it to main dir...

*sigh*

Z

Joined: Dec 2002
Posts: 2,809
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 2,809
Well you don't send CTCP commands to connect to the sender, mIRC initiates a socket connection. Yes, if you implemented the DCC SEND protocol using a script, then you could do this, but you can't use mIRC's internal DCC SEND/GET handling and change the filename like that.

Joined: Aug 2003
Posts: 14
M
MrZebra Offline OP
Pikka bird
OP Offline
Pikka bird
M
Joined: Aug 2003
Posts: 14
soo....then it is impossible to script something that will just do what mIRC's built in get dialog will do..

and its impossible to in any way manipulate that get dialog so that it would be automated...

ARGH...

Z

p.s. heh, scripting is so frustrating some times

Joined: Dec 2002
Posts: 2,809
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 2,809
In theory, you could modify the get dialog using a dll, but it would require a bunch of work in order to figure out how mIRC communicates with that dialog in order to have it send information back to mIRC, for example how does the dialog tell mIRC which filename you entered. It could be done, but it would require a decent amount of programming experience.

Joined: Aug 2003
Posts: 14
M
MrZebra Offline OP
Pikka bird
OP Offline
Pikka bird
M
Joined: Aug 2003
Posts: 14
Yeah...

I am totally unfamiliar with dll's...well...with WRITING them at least...
I can use them..but other than that i'm lost...

DARN IT DARN IT smile

Z

Joined: Dec 2002
Posts: 1,321
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Dec 2002
Posts: 1,321
Code:
ctcp *:DCC SEND*:?:{
  if !$regex($3-,/^(.+) (?!0 )(?:\d+) (?!0 )(?:\d+) (?!0$)(?:\d+)$/) {
    dcc reject
    halt 
  }
  tokenize 32 $regml(1)
  if $isfile($+(", $getdir($1-), $1-, ")) {
    var %e = $mid($1-, $pos($1-, ., $pos($1-, ., 0)))
    .rename $+(", $getdir($1-), $1-, ") $&
      $+(", $getdir($1-), $left($1-, $+(-, $len(%e))), -[, $ctime, ], %e, ")
  }
}




DALnet: #HelpDesk and #m[color:#FF0000]IR[color:#EEEE00]C
Joined: Aug 2003
Posts: 14
M
MrZebra Offline OP
Pikka bird
OP Offline
Pikka bird
M
Joined: Aug 2003
Posts: 14
Hammer, I'm not familiar with the $regex..but I"m gonna look that stuff up...

As to the second part with the .rename in it, isn't that renaming the file already on the hard drive? Not doing what mIRC's get dialog does, which is rename the incoming file to what you want ??

Thanks for the post, you obviously are much better at scripting than me, but i just wanted to ask these questions.

Z


Link Copied to Clipboard