Is there any reason you don't do it in AppleScript with Text Item Delimiters? You say you know AppleScript so I assume you know what TIDs are.
On Mon, Sep 8, 2008 at 7:56 AM, Charlie <[EMAIL PROTECTED]> wrote: > > I'm trying to step through a single large (1.5 mb) document and get > each chunk of text between a given delimiter. > > I know applescript but don't know perl, so thought I'd try to > accomplish this in BBEdit 8.7.x. > > Based on a script found here: > -- http://home.knuut.de/paul/index.html > > I've tried something like this: > > set SearchItems to text document 1 > set SearchPattern to "<p><hr><br>" -- the given delims > set SearchOptions to {search mode:true, case sensitive:false, match > words:true, showing results:false, returning results:true} > set TheHitList to find SearchPattern searching in SearchItems options > SearchOptions > set ResultList to found matches of TheHitList > set ct to count ResultList > > However the "found matches" of theHitList --> current application !! > > When I set SearchItems to a FILE alias, it works as expected, on a > smallish file. On my main file, it basically hangs applescript for > over 10 minutes (there are 5000+ results). It appears to execute the > search itself very quickly in BBEdit, but hang after issuing the > search command in applescript. > > Any idea what's going on or how I can make it respond better? > > Secondly, once I get an actual list, I intend to use the start_offsets > and the end_offsets of matches to calculate the offsets for each chunk > of text I actually want. > > But the script I found above does something similar by reading the > file into RAM and then using applescript's offsets command. That is > going to be a further CPU choke. > > Can BBEdit get text between offsets from the orginal file? How? > > Is there in general a better way to accomplish this? > > Thanks > > > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "BBEdit Talk" group. To post to this group, send email to bbedit@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/bbedit?hl=en -~----------~----~----~----~------~----~------~--~---