Re: Tex-Edit memory limitation
Re: Tex-Edit memory limitation
- Subject: Re: Tex-Edit memory limitation
- From: Frank Miedreich <email@hidden>
- Date: Thu, 18 Oct 2001 20:00:57 +0200
Hi,
3/4 of 39k sound awfully close to the old textedit limitation of
30000 characters, that sometimes seems to come up in the combination
of applescript and text. This is just a guess, but maybe there is
some place where the content of the Tex-Edit file is assigned to an
applescript variable, and everything beyond char 30000 is truncated.
This may be happening in the "count style runs", or possibly in some
other location where the whole of the document is accessed.
I have tried a variant of your script which may do the same thing, I
did not know what the style runs are supposed to do or where they
come from:
set itemlist to {"NAME", "BODY", "ALT", "HEIGHT", "WIDTH", ,
"IMG SRC", "STRONG", "UL>", "HREF", "DOCTYPE HTML PUBLIC", ,
"W3C", "/EN", "DTD", "HTML", "TITLE>", "CONTENT=", "<P", ,
"LINK REL", "CLASS", "BLOCKQUOTE", "A>", "HEAD", ,
"TYPE=", "STYLE", "META", "H>", "<H ", "<BR>", "DIV"}
tell application "Tex-Edit Plus"
repeat with tag in itemlist
set lcTag to my lc(tag as text)
replace front window looking for (tag as text) ,
replacing with (lcTag as text) ,
looking for styles {color:{0, 0, 0}} with
cases matching
end repeat
end tell
to lc(w)
set w to characters of w
repeat with c from 1 to length of w
set x to ASCII number of item c of w
if x > 64 and x < 91 then set item c of w to ASCII
character (x + 32)
end repeat
return w as text
end lc
(my apologies for the lc handler. I could not find the event with
which you change case of a string in applescript)
A side note: If you want to change HTML tags to lowercase, you may
want to look at the text editor Alpha. It uses tcl as a scripting
language, but the script gets really small and handles every html tag
correctly:
tell application "Alpha"
DoScript "html::TagstoLowercase"
-- DoScript "html::QuoteAllAttributes" -- may also be useful..
DoScript "menu::fileProc \"File\" \"save\""
DoScript "menu::fileProc \"File\" \"close\""
end tell
cheers, Frank
At 8:32 Uhr -0600 18.10.2001, Gnarlodious wrote:
I am using Smile 1.8.2 and also Script Debugger with Tex-Edit+ 4.1.2
running this script:
Change tags to lowercase
set itemlist to {"NAME", "BODY", "ALT", "HEIGHT", "WIDTH", "IMG SRC",
"STRONG", "UL>", "HREF", "DOCTYPE HTML PUBLIC", "W3C", "/EN", "DTD", "HTML",
"TITLE>", "CONTENT=", "<P", "LINK REL", "CLASS", "BLOCKQUOTE", "A>", "HEAD",
"TYPE=", "STYLE", "META", "H>", "<H ", "<BR>", "DIV"}
tell application "Tex-Edit Plus"
activate
tell front window
repeat with i from 1 to (count items in itemlist)
set currentItem to item i of itemlist
repeat with n from 1 to count of style runs
if color of style run n is "#333333" then
search style run n looking for currentItem
change case of selection into lowercase
end if
end repeat
end repeat
end tell
close front window saving ask
end tell
The file is 39K but both stop processing about 3/4 through the list and
reports Tex-Edit ran out of memory. I increased the memory to 5.1M with no
improvement. What is happening?
Rachel http://www.gnarlodious.com
--
Frank Miedreich
Mozquito Technologies AG
Check out our new Website at
http://www.mozquito.com/