I can’t see an operator / action to take the first x items of list, which means I need some sort of iteration.
I think I’m supposed to use $MyList.each(), but I can’t get it to work, and I’m not sure I’m understanding what’s going on. The atbref is helpful, of course, but I can’t get it work in these circumstances.
So, please:
a) is there an easier way which I’m just not seeing; or
b) is it possible to explain how to use .each() to do what I want?
No, I hadn’t tried it – but it was exactly what I was looking for, of course!
I’d actually spent half an hour looking in atbref for something like it (then on list operators and all the other stuff, and had done a search for word on the sitemap page as well.
Goodness knows how I missed it…
If you search the sitemap using ⌘F in Safari, and type “word” as the search string, Safari unhelpfully never shows you the result .word – you have to explicitly search for “.word”.
Ha – that will be it. Or it’s just creeping old age on my part… Either way, thanks!
Just to finish off the thread:
Using the first 15 words is OK until the first line of the text is so short that the 15 words includes line breaks. In case anyone else reads this and wonders about a workaround, here’s what I’ve found works:
This ensures that titles with less than 15 words are truncated properly and the continuation marker […] is added in the right spot. It works by splitting the entire text into a list, each item being a single paragraph (limited by \n), then creating a string with the first item of the list (at.(0)), restricted to fifteen words.