Hehe yeah that seems to work. I added a menu to free the hash table and remove the file (clean slate kinda thing) so I had to add a bit more to your On Input event.

Code:
On *:Start: {
  hmake wordcount 1000
  if ($isfile(wordcount.dat)) hload -o wordcount wordcount.dat 
}

dialog wordcount {
  title "Word Count"
  size -1 -1 190 155
  option dbu
  list 1, 8 13 86 117, size
  list 2, 95 13 86 117, size
  text "        Words                                          Number Of Words", 3, 29 3 148 8
  text "",4, 70 132 100 10
  menu "&File", 7
  menu "&Options",8,7
  item "Remove selected line", 9,8
  item "Remove Hash File",10,8
  item "Clear Dialog Data",11,8
  item break, 12,7
  item "&Close", 13,7
  button "Close",5, 7 140 175 10
}

on 1:dialog:wordcount:menu:9: { 
  if ($did($dname,1).sel) { 
    did -d wordcount 1 $did($dname,1).sel 
    did -d wordcount 2 $did($dname,2).sel 
  }
}

on 1:dialog:wordcount:menu:10: { 
  if ($isfile(wordcount.dat)) { 
    echo -a *** Word count set to 0 
    hfree wordcount 
    .remove wordcount.hsh
    dialog -x wordcount wordcount 
  }
}

on 1:dialog:wordcount:menu:11: { did -r wordcount 1,2 }

on 1:dialog:wordcount:init:*: {
  var %x = $hget(wordcount,0).item
  did -a wordcount 4 $ctr(160),100) Number of words: %x
  while (%x) {
    if ($dialog(wordcount)) {
      did -a wordcount 1 $str($chr(160),20) $hget(wordcount,%x).item
      did -a wordcount 2 $str($chr(160),25) $hget(wordcount,%x).data
    }
    dec %x
  }
}

On *:dialog:wordcount:sclick:1: { did -c wordcount 2 $did($dname,1).sel }
On *:dialog:wordcount:sclick:2: { did -c wordcount 1 $did($dname,2).sel }

On *:dialog:wordcount:close:0: { hsave -o wordcount wordcount.dat }

On *:dialog:wordcount:sclick:5: { dialog -x $dname $dname }


On *:input:*:{
  if (/* iswm $1) { return $1- }
[color:red]  if (!$hget(wordcount)) { hmake wordcount 1000 }[/color]
  hinc wordcount $*
}

alias wordcount {
  if (!$1) && (!$dialog(wordcount)) dialog -dm wordcount wordcount 
  if ($hget(wordcount,$1)) {  echo -a * /count: You have said $1 $hget(wordcount,$1) time(s) }
}



Cheers mate, you've been a great help. smile