I’m copy a text from the iOS books app and always get 4 lines of text with reference of book etc. at the end of the draft. I like to delete the four last lines via a script. I found the „delete lines“ action where the cursor is in the line but I have no idea how to get this for the last four lines. Maybe someone can point me to a side where I can find some information or a similar script.
The first line splits the draft by newline characters, counts the number of lines, subtracts 4 from it, then uses that to build a ‘line’ template. The ‘line’ template is evaluated to return the 1st to 4 from the last line lines of draft content. The drafts content is set equal to that … effectively knocking off the last 4 lines of the content.
The second line simply forces the draft to be updated.