Re: Help browser font size, code timing, RegEx
Re: Help browser font size, code timing, RegEx
- Subject: Re: Help browser font size, code timing, RegEx
- From: "Arthur J Knapp" <email@hidden>
- Date: Sat, 10 Mar 2001 18:12:24 -0500
>
Date: Sat, 10 Mar 2001 21:29:07 +0100
>
From: Harald E Brandt <email@hidden>
>
Subject: Re: Help browser font size, code timing, RegEx
>
set myString to REReplace myString pattern "SIZE=\"4\"" with "SIZE=\"5\""
>
set myString to REReplace myString pattern "SIZE=\"3\"" with "SIZE=\"4\""
>
set myString to REReplace myString pattern "SIZE=\"2\"" with "SIZE=\"3\""
>
RegEx manipulations are really fast, and I think so much more elegant than
>
TID fiddlings (although requiring an osax).
Just to point out, the above patterns aren't really regular expressions,
in the sense that no special characters are used, ie: if the above is all
that one needs to do, you could also use the replace command from
ACME Widgets, Akua Sweets, etc., as well as the RegEx addition and/or
the text item delimiters.
>
They are almost identically fast, with a slight advantage for RegEx.
>
However, at close to 300 kB, the TID version got out of memory and
>
destroyed/garbled the file! (With 2 MB memory allocation to droplet.)
>
The Regex version worked up to about 350 kB before memory problems, and
>
above that it terminated nicely without destroying the file.
You probably ran into the upper limit on string-to-list coercion,
around 4050-60 some items:
text items of str --> error if more than approx. 4060 text items
characters of str --> error if more than approx. 4060 characters
>
But PLEASE: could anyone explain to me why the last "case" thing gets
>
translated to
>
'with ignoreCase' when the script is saved or checked, whereas it *refuses*
>
to accept
>
'with ignoreCase' on subequent saves?? Very irritating!...
The explaination is that the AppleScript compiler is very mean, and
doesn't like readability, line breaks, or people. :)
>
What is the workaround?
Parentheses:
... ignoreCase (true)
>
PS: I used both "the ticks" (from Jon's Commands) and "time of (current
>
date)" for my timings. The latter is so coarse because it only gives
>
seconds, but the former is quite noisy and unpredictable. The two methods are
>
not always consistent. What *is* really the best way to time things around
>
one or a few seconds? DS
As with all timing type scripts, you just want a big enough "sample",
run enough times, such that any inconsistencies are averaged out. If you
P.S. Did he describe "the ticks" from Jon's commands as "noisy" ???
Arthur J. Knapp
http://www.stellarvisions.com
mailto:email@hidden
Hey, check out:
http://www.AppleScriptSourceBook.com