Re: running out of steam
Re: running out of steam
- Subject: Re: running out of steam
- From: richard brosnahan <email@hidden>
- Date: Wed, 03 Jan 2001 19:56:54 -0500
on 1.3.2001 6:40 PM, Christopher C. Stone at email@hidden wrote:
>
At 01/03/01 12:11 -0500, richard brosnahan wrought:
>
>
> I have a script that repeatedly modifies lines of text in a BBEdit window. I
>
> currently execute the script from Smile, but I intend to just add it to the
>
> script menu in BBEdit once I'm confident the bugs are all gone.
>
>
>
> The files have an average of 100 lines, and I make 8 changes per line. It
>
> runs well, but after about half the lines have been processed, the script
>
> slows and will stop unless I move the mouse.
>
>
>
> I've seen this discussed... I think I've seen it discussed. I've not found
>
> the discussion or solution to this. Is it a memory leak? What causes this
>
> slowdown?
>
___________________________________________________________________________
>
>
Hello Richard,
>
>
When posting this sort of thing it's Very relevant to include what version of
>
BBEdit;Smile; etc. you have.
>
>
The problem you describe is odd with only 100 lines. I'd like to see the
>
script.
>
>
>
Best Regards,
>
>
Christopher Stone
>
______________________________
>
StoneWorks Computer Consulting
Very good point.
Mac OS 9.04, BBEdit 6.02, Smile 1.75, powerbook G3 500mhz/256meg RAM,
plugged in (not depending on batteries when the script runs)
I see the same result when running on an iMac with roughly the same config.
here's the section of the script, with some stuff removed. I don't think it
will run with the code removed. The file in question has about 100 lines of
text. Each line is a tab delimited record being prepared to import into a
database.
This is proprietary code, so I have to be careful what I post on the public
lists:
tell app "bbedit 6.0"
-- a whole bunch of stuff deleted
set done to false
set so to {reverse:false, extend selection:false,,
starting at top:false, wrap around:false, search mode:literal}
set soExtend to {reverse:false, extend selection:true,,
starting at top:false, wrap around:false, search mode:literal}
tell text window windowToCheck
-- we can translate the whole dang doc at once, with no ill effect
-- there's no reason to do it piecemeal
translate text to html with entity conversion ,
and ignore angle brackets without paragraph conversion,,
selection only and create new document
select insertion point before first character
-- this is where the interesting delays develop
repeat until done
find "<!-- section 1 -->" options so with selecting match
set selection to ""
find "<!-- section 2 -->" & tab options soExtend ,
with selecting match
find "<!-- section 2 -->" & tab searching in selection,
options so with selecting match
set selection to tab
select insertion point after selection
-- select the body of the story
find "<!-- section 3 -->" options soExtend with selecting match
replace return using "<br>" searching in selection options so
find "<!-- section 3 -->" searching in selection options so ,
with selecting match
set selection to ""
-- move to the next record
set foundRec to find "<!-- start -->" options so ,
with selecting match
set done to not found of foundRec
if done then
select insertion point after the last character
else
-- clear the "<!-- start -->" thing
set selection to ""
end if
end repeat
end tell -- window windowToCheck
end tell -- bbedit
===============================
Richard Brosnahan
Editor in Chief
Broznews
http://broznews.com/