Code:
on *:dialog:comby:sclick:2: {
[color:red];clear the edit line 
did -r $dname 4[/color]
did -a $dname 4 %tempmessage $did(4)
}
on *:dialog:comby:sclick:3: {
did -o $dname 4 %tempmessage $did(4)
[color:red]add the write command[/color] 
}

Where do your code write to the txt file? you must use "write" to get the info to a txt file..