What I am trying to do is to stop adding the nickname more than once to the file by looking for the nickname and if it exists, to not write it. If it does to write it. (And no writing to files is not one of my strong points if you haven't already guessed.)

Code:
if ($did == 5) {
  if ($did(4).text isin test.txt) {
    .echo $did(4).text is already listed!
    halt
  }
  else {
    .write files\test.txt $did(4).text
  }
}


Thanks in advance.