Handling big numbers of paragraphs

I was testing the script that triggered my previous post with lots of line (~200,000 instead of ~500) and it failed (timeout).

The code that fails is this:

	-- fill the data set with the contents of the documents
	repeat with i from 1 to myNbofDocuments
		set end of myRawData to paragraphs of document i
	end repeat

There are only 2 documents so there clearly is an issue with the sheer number of paragraphs (lines) here.

What would be the best way to nicely handle such volumes ?

AppleScript can have problems with lists that big. Read directly from the files using ASObjC, and convert that to arrays. BridgePlus also has a paragraphsOfString: method for convenience.

1 Like

The manual for BridgePlus seems to be on the Automation site. Is there a PDF version ?

No, HTML only. I tried an experiment: these docs in HTML, others as PDF. I seem to have managed to displease both camps :upside_down_face:

:slight_smile: The only issue is that the structure does not allow to see all the info at once and so I’m not sure what to look for:

https://www.macosxautomation.com/applescript/apps/BridgePlus_Manual/Index.html

The “summary” field would be very useful on the Index page :slight_smile:

Use Show Package Contents on the app in the Finder, and burrow down to the header file:
/Contents/Library/Script Libraries/BridgePlus.scptd/Contents/Frameworks/BridgePlus.framework/Versions/A/Headers/SMSForder.h

That lists all the Objective-C methods in one place.

1 Like