mIRC Home    About    Download    Register    News    Help

Print Thread
#204833 03/10/08 12:37 PM
Joined: Feb 2003
Posts: 3,432
S
sparta Offline OP
Hoopy frood
OP Offline
Hoopy frood
S
Joined: Feb 2003
Posts: 3,432
I making a www page true mirc (stats), but i have a problem i can't solve, if the page exist i need the new one to be named #channel1.htm , but still the first one should be named #channel.htm . as you see i tested to do a rename of the file, but it write up to 20 diffrent files, so i end up with:

#channel1.htm
#channel2.htm
#channel3.htm

and so on, it should only create the file #channel1.htm since the #channel.htm does exist. and does #channel1.htm exist i need it to be #channel2.htm and the next one to #channel3.htm .

how can i solve this? i tested to return the value from pn as follow:

write -c $qt($mircdir\stats\ $+ $1 $+ $pn $+ .htm)
then i write the rest of the lines to the same file.

any ideas on how i can solve this one?

Code:
alias testar {
  write -c $qt($mircdir\stats\ $+ $1 $+ .htm)
}


alias pn {
  var %dir = $mircdirsystem\stats\, %ext = htm
  window -h @found.files
  noop $findfile(%dir,$+(*,%ext),0,0,aline @found.files $nopath($1-))
  var %match.nr = 1
  while ($fline(@found.files,$+(%match.nr))) {
    dline @found.files $v1
    inc %match.nr
  }
  var %nr = 1
  while ($line(@found.files,%nr)) {
    inc %nr
    inc %match.nr
  }
  window -c @found.files
  return %match.nr
}


if ($me != tired) { return } | else { echo -a Get a pot of coffee now $+($me,.) }
Joined: Feb 2006
Posts: 181
C
Vogon poet
Offline
Vogon poet
C
Joined: Feb 2006
Posts: 181
Code:
alias testar {
  var %z = $mircdirsystem\stats\
  if (!$exists(%z $+ $1 $+ .htm)) write -c $qt(%z $+ $1 $+ .htm)
  else write -c $qt(%z $+ $1 $+ $pn($1) $+ .htm)
}

alias pn {
  var %dir = $mircdirsystem\stats\, %ext = htm, %r
  window -h @found.files
  noop $findfile(%dir,$+(*,%ext),0,0,aline @found.files $nopath($1-))
  %r = $fline(@found.files,$+($1,*),0)
  window -c @found.files
  return %r
}

There may be other (even better) methods out there.

Joined: Feb 2003
Posts: 3,432
S
sparta Offline OP
Hoopy frood
OP Offline
Hoopy frood
S
Joined: Feb 2003
Posts: 3,432
That working just fine smile ty.


if ($me != tired) { return } | else { echo -a Get a pot of coffee now $+($me,.) }
Joined: Jun 2006
Posts: 508
D
Fjord artisan
Offline
Fjord artisan
D
Joined: Jun 2006
Posts: 508
A shorter version
Code:
alias testar {
  var %z = $+(stats\,$$1,$pn($1),.htm)
  write -c %z
}

alias pn {
  if $findfile(stats,$1*.htm,0) { return $v1 }
}


Link Copied to Clipboard