I'm sure you know how to set the trigger, thus I'll outline only some possible steps for the copy-n-change itself:

Most simple, yet slowest solution:
1) copy the file with /copy
2) Scan for the line you want to change: $read(s) or $read(w) or $read(r) > $readn
3) replace/modify this line with /write -l /write -il etc.
( steps 2&3 could be one single step if you use /write -sl / -wl / -rl )

More advanced (will be noticeably faster if there are many lines to change):
use file handling (/fseek and /fwrite) instead of $read and /write

Or (might be the fastest solution - worth the effort if you're going to change the file heavily):
1) bread the file into a binary variable (into RAM)
2) modify the binvar with $bfind, /bset, /bcopy etc.
3) /bwrite ("dump") the final data to the output location

If you want to create an "evaluated" copy of a whole file, you could create a while loop that reads all lines of the infile and writes the evaluated line to an outfile, e.g.:
Code:
; /evalcopy "infile":"outfile"
alias evalcopy {
  tokenize 58 $1-
  if ($isfile($2)) { write -c $2 }
  var %n = 1
  while ($read($1,%n)) { write $$2 $v1 | inc %n }
}
...obviously this will cause problems if your infile contains unknown text and/or code you don't want to evaluate, e.g. words starting with "%" or "&" or "$" etc. Depending on the actual file size, you may again use file handling instead of $read and /write.
I think it's preferable to put some distinct "keywords" in the first file, some words you'll easily find with one of the read methods mentioned above, then you can replace these lines or $replace just the keywords with the data they represent (e.g. the content of a variable)

Last edited by Horstl; 08/04/09 12:13 AM.