Without trying this, I would think that the value returned would be 1 "user canceled action" which is usually what you get when a script pauses on a dialog box (other than show custom dialog) and the user clicks "cancel".
Sometimes, when I don't know the error code, I get a bit lazy and use:
If [ Get ( LastError ) ]
This will cause the IF block to execute for any error code but 0 (no error) returned by this get function.
You can also use this code to discover an error code:
Set variable [$Error ; value: Get ( LastError ) ]
Show Custom Dialog [$Error ]
And you can use:
Set Error Capture [on]
to keep the filemaker generated error from interrupting your script.
I had already tried to use 1 with no luck. I wasn't aware of the if[Get(LastError)] trick, I may try that but then I risk recording a mail as sent if a different error pops up.
I suppose I could add a line to the script Set variable $$error (get(LastError) and watch the data viewer. Didn't think of that yesterday for some reason.
You can also just step through the script in the script debugger, cancel the email and watch for the error code that would then display in the bottom of the debugger.
I used the debugger and it returned 1 as the error code. Looks like my problem was with location of the line If [Get(LastError)=1].
had to move it up to just below the send mail line, evidently a beep or pause(.25 seconds in this case) erases the last error code. Turns out we where both correct to use 1 as the error code.
Thanks for reminding me the debugger displays error codes, something I had forgot to check.
Yes, Get ( LastError ) returns the error code only from the immediately previous script step.