mIRC Home    About    Download    Register    News    Help

Print Thread
Need help scripting version of mIRC's get dialog! #43960 24/08/03 08:46 PM
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

Re: Need help scripting version of mIRC's get dialog! #43961 24/08/03 08:48 PM
Joined: Dec 2002
Posts: 2,809
C
codemastr Offline
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 2,809
I don't believe this can be done.

Re: Need help scripting version of mIRC's get dialog! #43962 24/08/03 09:11 PM
Joined: Dec 2002
Posts: 774
T
theRat Offline
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
Re: Need help scripting version of mIRC's get dialog! #43963 24/08/03 09:18 PM
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

Re: Need help scripting version of mIRC's get dialog! #43964 24/08/03 10:20 PM
Joined: Jun 2003
Posts: 67
D
demitrix Offline
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
}
Re: Need help scripting version of mIRC's get dialog! #43965 24/08/03 10:58 PM
Joined: Dec 2002
Posts: 417
O
Othello Offline
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....
Re: Need help scripting version of mIRC's get dialog! #43966 24/08/03 11:03 PM
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

Re: Need help scripting version of mIRC's get dialog! #43967 24/08/03 11:09 PM
Joined: Dec 2002
Posts: 2,809
C
codemastr Offline
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.

Re: Need help scripting version of mIRC's get dialog! #43968 24/08/03 11:11 PM
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

Re: Need help scripting version of mIRC's get dialog! #43969 24/08/03 11:27 PM
Joined: Dec 2002
Posts: 2,809
C
codemastr Offline
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.

Re: Need help scripting version of mIRC's get dialog! #43970 24/08/03 11:35 PM
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

Re: Need help scripting version of mIRC's get dialog! #43971 25/08/03 12:18 PM
Joined: Dec 2002
Posts: 1,321
H
Hammer Offline
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
Re: Need help scripting version of mIRC's get dialog! #43972 25/08/03 06:46 PM
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