It seems the GroupWise speller runs in its own thread. This means the process doesn’t wait until the speller process is done. This is why the applet continues, and the message is sent, before the speller has a chance to complete.
The only work around I can think of that doesn’t involve Novell changing the way the speller works is to put the applet in a loop that simply processes the windows message loop until the speller process is done. I’ve done this in the example code below by looking for the Writing Tools window.
Please note this code requires a little more robustness to be built in, and has not been extensively tested.
Dim Recipient Sub Main(Client, GWEvent) Recipient = Groupwise.ItemGetText("X00", itfTo) If (Instr(1, Recipient, "@", 1) > 0) Then If (Instr(1, Recipient, "shlegal.com", 1) = 0) then dim iReturnVal call groupwise.throwtoken("Speller(0)", iReturnVal) ' Speller runs in a different thread, so we need to wait until ' the speller is done before returning. dim iSpellerWindow Utilities.DoEvents iSpellerWindow = utilities.FindWindow("" , "Writing Tools") while iSpellerWindow <> 0 Utilities.DoEvents iSpellerWindow = utilities.FindWindow("" , "Writing Tools") wend MsgBox "Speller Done" End If End If End Sub
I hope this helps,