Start the script with Allow User Abort [on] Allow User Abort [Off].
Add the "Set error capture (on)" script step to the top.
After the Save As PDF script step add this to capture the user pressing cancel:
go to layout(original)
you could choose the "No Dialogue" and the "Automatically open" to the script step "Save Records as PDF" to bypass
Unless user abort is off, the user can cancel the script at any time. Error capture won't help that.
Error Capture is for handling errors. Allow User Abort is for controlling whether a script runs to completion or not. Sometimes you need both, but they aren't the same.
All you need to do is put Allow User Abort [off] at the top of the script.
Both Vaughan and Carl's solutions work for me. I choose Vaughan's solution as the Correct Answer because it's the easiest way to solve my problem.
dsvail: I'm sorry, I must did something wrong but I tried what you suggested but it doesn't work for me.