The following handler will do what you expect.
on deleteButton
select cd btn "anotherButton"
doMenu "Clear Button"
select me
pass deleteButton
end deleteButton
As you might guess, having a script delete other objects after receiving a
deleteButton message can create some problems and bring up some tricky
issues. The main point here is that when HyperCard sends certain messages
like deleteButton and deleteField, the object has not yet been deleted.
Therefore, HyperCard currently deletes the selected/current object after
this message is sent (this may change so do not rely on it). So, when you
have a script that does something on a delete message, just make sure that
the object selection does not change after this message is sent. Example,
if you have
on deleteButton
select cd fld 1
end deleteButton
the first field will be deleted. Also, no "deleteField" message will be
sent because you tricked HyperCard into deleting a field when it thought it
was going to delete a button.
A final note: Watch out for unexpected recursion. The example script you
included can easily become recursive by putting this anywhere but in a
button or a field script.
This article is adapted from the Claris Tech Info database.