alias wc { dialog -md Word Word } dialog Word { title "Word Counter" size -1 -1 241 120 option dbu box "Information", 1, 3 100 193 18 edit "", 2, 6 106 188 10, read edit "", 3, 1 7 193 89, multi return autohs box "Stuff you want counted", 4, 0 0 196 99 radio "Words", 5, 196 72 50 10 radio "Characters", 6, 196 80 50 10 radio "Both", 7, 196 88 50 10 button "Calculate", 8, 198 104 42 14 text "To count the words, paste the text in the box on the left, select what you want calculated, and click calculate. It will return how many in the information box.", 9, 198 3 43 66 } on *:DIALOG:word:sclick:8: { if ($did(word,5).state == 1) { set %x 1 set %lines $did(3).lines while (%x <= %lines) { tokenize 32 $did(3,%x) inc %words $0 inc %x } did -ra word 2 There are %words words in the above text unset %words } if ($did(word,6).state == 1) { set %y 1 set %lines $did(3).lines while (%y <= %lines) { inc %chars $len($did(3,%y)) inc %y } did -ra word 2 There are %chars characters in the above text unset %chars } if ($did(word,7).state == 1) { set %x 1 set %lines $did(3).lines while (%x <= %lines) { tokenize 32 $did(3,%x) inc %words $0 inc %x } set %y 1 set %lines $did(3).lines while (%y <= %lines) { inc %chars $len($did(3,%y)) inc %y } did -ra word 2 There are %words words and %chars characters in the above text unset %chars %words } }