Help with error with bulk Text Messaging Shortcut for appointment reminders

I created a shortcut to send bulk text message appointment reminders. The shortcut gets appointment time, name and phone number from a pdf exported from an appointment software. The shortcut iterates through the contact information generating the text messages. I manually press send on each text message and the shortcut iterates to the next text message autopopulating the contents of the reminder message. The process repeats until it finishes each item from the list generated from the PDF text. My problem is that the shortcut ends on an error even though the text messages get sent. Changing <Get item at index 2 from Split Text> to <index 1> results in wrong data being populated in the text message. I am not proficient with programming or Shortcuts and would appreciate any assistance resolving this error message.

Here is the shortcut.

https://www.icloud.com/shortcuts/f888a0b44b804d159ed11a583e296adf

You are splitting by period, so chances are it is picking up something after the final period and making that a fourth entry which does not have the required data and is then trying to access elements of that because it has no spaces to split that fourth item on.

You can check this with bey show result or quick look and looking at each split contact in turn - maybe wrap them in double quote to help visualise white space, newline, bulls, etc.

You probably just want to ignore the last entry based on your current approach. You could do this by either dropping it, or maybe removing the final period occurrence before you split the text by it.

Hope that helps.

You were right. The period at then of the last line in the pdf seems to be the reason for the error. Period removed, error gone for now. Thanks again.