mIRC Home    About    Download    Register    News    Help

Print Thread
#189577 09/11/07 01:24 AM
Joined: Nov 2007
Posts: 3
A
Self-satisified door
OP Offline
Self-satisified door
A
Joined: Nov 2007
Posts: 3
Hi. I've got a problem. I need %hhh from alias aaa, but it seems I made in a wrong, could anyone give me a good idea for this purpose, please.
Quote:

aaa
if %hhh <...
alias aaa {
%j = 0
while ($findfile(D:\zzz,*.yyy,0,1) == 0) && (%j <= 10) {
dll rushmirc.dll RushScript RushApp.FTP.Transfer(0, 'sss', '/ppp/', 'ooo', '', D:\zzz\', 'ooo', RS_DOWN or RS_DIRSRC or RS_DIRDES or RS_CHECKLOGIN or RS_NOMKD, '', '', '*.yyy', '', '([^\w]*100%[^\w]*)|([^\w]*-\sCOMPLETE\s\ $+ $chr(41) $+ [^\w]*)|(\ $+ $chr(40) $+ ([^\w]|[\w])*-\sCOMPLETE\s\ $+ $chr(41) $+ [^\w]*)|([^\w]*-[\[\s]COMPLETE[\]\s]-[^\w]*)|\.COMPLETE\ $+ $chr(40) $+ |(\.(avi|mpeg|mpg|jpg|yyy)$)', 500, 0, 0, 0, RS_SORTDES or RS_SORTSIZE, 1, 0)
inc %j
}
unset %j
k = 1
timer1 180 1 bbb
}
alias bbb {
if ($findfile(D:\zzz,*.yyy,0,1) = 0) && (%k <= 179 ) inc %k
else {
timer1 off
unset %k
%hhh = $findfile
}
}

Last edited by alienalie; 09/11/07 01:25 AM.
Joined: Nov 2006
Posts: 1,559
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Nov 2006
Posts: 1,559
I'm not sure what these aliases shall do... please explain what's the purpose of your code smile

A formal problem is for sure this line:
"k = 1"
I think you mean: "%k = 1" (or "set %k 1")

In addition, if you use named timers ("timer1 ...") you should give them unique names like "timerFindFile ..."

...anyway: I'm unable to comprehend what alias bbb is made for, and can only guess about alias aaa smile

Joined: Nov 2007
Posts: 3
A
Self-satisified door
OP Offline
Self-satisified door
A
Joined: Nov 2007
Posts: 3
I changed some scripts following your idea.
alias aaa makes 11 tasks to download *.yyy for rushftp.
alias bbb will check *.yyy every second in the next 3 minutes. when the file(s) exist(s), give the first filename in folder
D:\zzz to %hhh.
the main one will use %hhh(if %hhh <...) for the following scripts.
Code:
aaa
if %hhh == xyz.yyy msg #crim %hhh
else msg #crim something wrong
echo -s %hhh
unset %hhh
alias aaa {
%j = 0
  while ($findfile(D:\zzz,*.yyy,0,1) == 0) && (%j <= 10) {
    dll rushmirc.dll RushScript RushApp.FTP.Transfer(0, 'sss', '/ppp/', 'ooo', '', D:\zzz\', 'ooo', RS_DOWN or RS_DIRSRC or RS_DIRDES or RS_CHECKLOGIN or RS_NOMKD, '', '', '*.yyy', '', '([^\w]*100%[^\w]*)|([^\w]*-\sCOMPLETE\s\ $+ $chr(41) $+ [^\w]*)|(\ $+ $chr(40) $+ ([^\w]|[\w])*-\sCOMPLETE\s\ $+ $chr(41) $+ [^\w]*)|([^\w]*-[\[\s]COMPLETE[\]\s]-[^\w]*)|\.COMPLETE\ $+ $chr(40) $+ |(\.(avi|mpeg|mpg|jpg|yyy)$)', 500, 0, 0, 0, RS_SORTDES or RS_SORTSIZE, 1, 0)
    inc %j
  }
  unset %j
  %k = 1
  timerfindfile 180 1 bbb
  set %hhh 0
}
alias bbb {
  if ($findfile(D:\zzz,*.yyy,0,1) = 0) && (%k <= 179 ) inc %k
  else {
    timerfindfile off
    unset %k
    %hhh = $findfile(D:\zzz,*.yyy,1,1)
  }
}

Last edited by alienalie; 09/11/07 04:18 PM.
Joined: Nov 2006
Posts: 1,559
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Nov 2006
Posts: 1,559
If you'd use mIRC dcc get, you could use the "on filercvd" event and would not need that timer or filecheck stuff... like:
Code:
on *:filercvd:*: {
  echo -s just received a file from nick $nick : $filename
  echo -s filename: $nopath($filename) folder: $nofile($filename) extension: $gettok($nopath($filename),-1,46)
  echo -s size $file($filename).size bytes ... thats $bytes($file($filename)).suf
}


This is just a quick shoot....
Code:
; syntax: "get.file extension[without dot] dir"
; e.g. "/get.file yyy d:\zzz"


alias GET.file {
  ; error checking: no valid dir
  if (!$isdir($2-)) {
    echo -a no valid dir specified
    return
  }
  ; error checking: request running
  if (($timer(.watch.file)) && ($gettok($timer(.watch.file).com,2-,32) != $1-)) {
    ECHO -a I'm still trying to get $+(*.,$gettok($v1,1,32)) for $gettok($v1,2-,32)
    return
  }

  ; if a file with that extension exists in that dir,
  ; trigger the alias "exists.file" wih the filename of the first match
  if ($findfile($2-,$+(*.,$1),1,1)) { EXISTS.file $v1 }

  else {
    ; if it's the first attempt to get that file
    if (!%get.file.requests) {
      ; set the requests-counter
      set -e %get.file.requests 0
      ; and start the watching for the get (check 60 times all 5 seconds = 3mins) 
      set -e %watch.file 1
      .timer.watch.file 60 5 WATCH.file $1-
    }
    ; try max. 10 times to get the file
    if (%get.file.requests < 10) {
      inc %get.file.requests
      REQUEST.file $1-
    }
  }
}

alias REQUEST.file {
  ; trigger the dll to get the file - note that I changed "file extension" and "dir" in the dll command part
  ; to fit the syntax
  dll rushmirc.dll RushScript RushApp.FTP.Transfer(0, 'sss', '/ppp/', 'ooo', '', $2- $+ ', 'ooo', $&
    RS_DOWN or RS_DIRSRC or RS_DIRDES or RS_CHECKLOGIN or RS_NOMKD, '', '', '*. $+ $1 $+ ', '', $&
    '([^\w]*100%[^\w]*)|([^\w]*-\sCOMPLETE\s\ $+ $chr(41) $+ [^\w]*)|(\ $+ $chr(40) $+ $&
    ([^\w]|[\w])*-\sCOMPLETE\s\ $+ $chr(41) $+ [^\w]*)|([^\w]*-[\[\s]COMPLETE[\]\s]-[^\w]*)|\.COMPLETE\ $+ $&
    $chr(40) $+ |(\.(avi|mpeg|mpg|jpg| $+ $1  $+ )$)', 500, 0, 0, 0, RS_SORTDES or RS_SORTSIZE, 1, 0)

  ; restart the get.file "loop" (make max. 10 attempts to get the file if the file is not existing)
  .timer.get.file 1 1 GET.file $1-
}

alias WATCH.file {
  if (%watch.file < 60) { 
    inc %watch.file
    if ($findfile($2-,$+(*.,$1),1,1)) { EXISTS.file $v1 }
  }
  else { 
    unset %get.file.requests
    ECHO -a FAILED to get a file $+(*.,$1) to dir $2- 
  }
}

alias EXISTS.file {
  unset %get.file.requests
  unset %watch.file
  if ($timer(.get.file)) { .timer $+ $timer($v1) off } 
  if ($timer(.watch.file)) { .timer $+ $timer($v1) off } 

  ECHO -a FOUND $1-
}

Joined: Nov 2007
Posts: 3
A
Self-satisified door
OP Offline
Self-satisified door
A
Joined: Nov 2007
Posts: 3
First of all, thank you for your help and solution. I have spent a few days figuring your scripts out above. I found another problem that I need to use those scripts before 'EXISTS.file' finishes or 'timer.watch.file' is running. Please give me some tips. Regards.


Link Copied to Clipboard