mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: May 2004
Posts: 14
P
Pikka bird
OP Offline
Pikka bird
P
Joined: May 2004
Posts: 14
Hello,

I need to close DCC GET windows by code. I'm using:
Code:
/window -c "Get $+($nick,$chr(32),$nopath($filename),")

This works fine. However, it fails for long filenames. I can't precise the limit length, but certainly 77 characters and over fails. I tried cutting the filename to %len characters:
Code:
/window -c "Get $+($nick,$chr(32),$left($nopath($filename),%len),")

but whatever the value of %len it still fails. Using $window I'm able to access the GET window's properties, because $window accepts wildcards. But I don't know how to feed those properties to /window.

Any ideas?

Joined: Mar 2004
Posts: 130
T
Vogon poet
Offline
Vogon poet
T
Joined: Mar 2004
Posts: 130
/close -g nickname
.

Joined: May 2004
Posts: 14
P
Pikka bird
OP Offline
Pikka bird
P
Joined: May 2004
Posts: 14
Hi,
Quote:
/close -g nickname

I'm sorry but it's not good for me. I need to close a precise GET window, identified by nick and filename (or else, by wid/hwnd).

Thanks for your answer though.

Joined: Mar 2004
Posts: 130
T
Vogon poet
Offline
Vogon poet
T
Joined: Mar 2004
Posts: 130
-g close get windows

Joined: May 2004
Posts: 14
P
Pikka bird
OP Offline
Pikka bird
P
Joined: May 2004
Posts: 14
Hi,
Quote:
-g close get windows

I know the -g switch. But, as I said, I need to close not all GET windows by $nick, but one specific window.

If you need precisions, my code is called from a FILERCVD event. It should affect only the current GET.

Other ideas?

Joined: Dec 2002
Posts: 788
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 788
Okay, well, this may not be the ideal solution but.

On *:FILERCVD:*:{
%tmp = $nopath($filename) | %tmp2 = $nick | %i = $get(0)
while (%i) {
if (($get(%i).file == %tmp) && ($get(%i) == %tmp2)) { close -g $get(%i) }
dec %i
}
}

Eamonn.

Joined: Jan 2003
Posts: 2,523
Q
Hoopy frood
Offline
Hoopy frood
Q
Joined: Jan 2003
Posts: 2,523
/close -g[color:red]N $nick[/color] closes the Nth dcc get window from $nick. With this and the newly added $get(-1) you can probably do what you want:
Code:
on *:filercvd:*:{
  var %i = 1
  while $get($nick,%i).wid != $get(-1).wid { inc %i } 
  close -g $+ %i $nick
}
I haven't come across the bug with /window -c you were talking about, so I'm not sure that /close -g solves your problem, but it's worth a try.


/.timerQ 1 0 echo /.timerQ 1 0 $timer(Q).com
Joined: Jan 2003
Posts: 2,523
Q
Hoopy frood
Offline
Hoopy frood
Q
Joined: Jan 2003
Posts: 2,523
/close -g nick closes ALL dcc get windows with that nick, which is what the OP wants to avoid. Btw, a small suggestion: you can loop through $get($nick,N) instead of $get(N), meaning less iterations.


/.timerQ 1 0 echo /.timerQ 1 0 $timer(Q).com
Joined: Mar 2004
Posts: 130
T
Vogon poet
Offline
Vogon poet
T
Joined: Mar 2004
Posts: 130
If you now thet -g close get windows why you are using -c ?

Joined: May 2004
Posts: 14
P
Pikka bird
OP Offline
Pikka bird
P
Joined: May 2004
Posts: 14
Hello,
Quote:
while $get($nick,%i).wid != $get(-1).wid { inc %i }
close -g $+ %i $nick

This is excellent!! I'll workship you henceforth grin

For those who are interested, here's the final code I settled for:
Code:
on 1:FILERCVD:*:{
  var %i = 1
  while (%i <= $get($nick,0)) {
    if ($get($nick,%i).wid == $get(-1).wid) {
      close -g $+ %i $nick
      break
    }
    inc %i
  }
}

Thanks and regards.


Link Copied to Clipboard