I have a script that has been working fine. For no apparent reason it started failing (other then perhaps the output has grown). However, the failure does not produce an error. Here is the failing line:
set items_list to (do shell script /usr/local/bin/myscript)'s paragraphs
The result is a huge error box that contains the output from the shell script. The only thing I can think of is that the ‘items_list’ can’t hold the data. Can someone tell me what this really means and if it is indeed some kind of size limit, if there is a way to increase it? TIA.
Thanks for the reply. If I understand this correctly it is not applicable. The issue is not the size of the shell script command but rather the size of the output being inserted into the Applescript list variable.
I think the problem isn’t how many items you can get in a list, which is virtually limitless, but how many text elements (characters, words, paragraphs, or text items) can be extracted from text in one go. The last I heard, it was a tad under 4000. I don’t know how many paragraphs you have, or what you want to do with them, but you could extract them, say, 3900 or less at a time. Something along these lines:
set the_text to (do shell script "/usr/local/bin/myscript")
-- This doesn't 'get' the paragraphs. It only counts them. So it doesn't crash.
set para_count to (count the_text's paragraphs)
set i to 1
repeat until (i > para_count)
set j to i + 3899
if (j > para_count) then set j to para_count
set para_list to paragraphs i thru j of the_text
-- Do something with this batch of 3900 or less paragraphs
set i to j + 1
end repeat