Hi @BrianS I hope you are doing well.
Yes, totally agree with you, it is a little more elaborate, but it is the smarter way to use the error handler and how to overcome situations like this one.
Now, here below is an image that showcases how to set up the Error Handler of the action Extract PDF.
- First you need to create a new Rule
- In this rule you will handle All Errors
- The variable can be like “PdfExtractionError”
- The value set up as YES
- Then in the IF statement, you are validating if the variable % PdfExtractionError % contains YES
- If YES, that means there was an error
- If not, keep looping
Here is the code snipped:
Variables.CreateNewList List=> List
LOOP LoopIndex FROM 1 TO 20 STEP 1
Pdf.ExtractPages PDFFile: $'''D 2024.pdf''' PageSelection: LoopIndex ExtractedPDFPath: $'''D:\\User\\wsanchez\\Course RPA\\PDF Multiple Pages\\PAD Comunnity Responses 2024_%LoopIndex%.pdf''' IfFileExists: Pdf.IfFileExists.Overwrite ExtractedPDFFile=> ExtractedPDF
ON ERROR
SET PDFExtractionError TO $'''YES'''
END
IF Contains(PDFExtractionError, $'''YES''', True) THEN
ERROR => LastError Reset: True
SET ErrorToBeAdded TO $'''%LoopIndex%-%LastError.Message%'''
Variables.AddItemToList Item: ErrorToBeAdded List: List
SET PDFExtractionError TO $'''NO'''
END
END
Display.ShowMessageDialog.ShowMessage Message: List Icon: Display.Icon.None Buttons: Display.Buttons.OK DefaultButton: Display.DefaultButton.Button1 IsTopMost: True ButtonPressed=> ButtonPressed
Hope this helps to clarify any doubt,
If I have addressed your inquiry successfully, kindly consider marking my response as the preferred solution. If you found my assistance helpful, a 'Thumbs Up' would be greatly appreciated.
Additionally, if you have any questions, feel free to DM me, and we can initiate a discussion.
Kind regards,
Will SG
Managing Director & Automation Lead
RAMS CR (Recruitment & Automation)
LinkedIn Profile
