This from Geoff WALLACE - dated 1/11/04 10�01 am:
> I have a script to remove [ ], what would one to remove (some text) look
> like.
The standard way to approach this would be by manipulating AppleScript's
'text item delimiters' - which you've already done to remove the trailing
square bracket in the script you posted.
The default text item delimiter (ie, that which separates each indiviual
component of a string) is nothing at all - displayed as opening quote marks
followed immediately by closing quote marks (""). So in a conventionally
delimited string, each letter, space and punctuation mark is an individual
text item.
Resetting the text item delimiters (TIDs) changes that. If for example you
set AS's TIDs to "]", then show it this string...
" Fw: [steam_tech] Bavarian Locomotive R3/3 later BR 89"
...AS sees two text items: " Fw: [steam_tech" and " Bavarian Locomotive
R3/3 later BR 89"
Here's an example drawn from your other recent post:
> Would also like to remove this "[steam tech] Re: [steam tech] Re: Bulleid's
> CI� CC1- More Details"
>
> Make it "Re: Bulleid's CI� CC1- More Details"
Setting AS's TIDs to "Re:" would carve the original subject line into three
text items: "[steam tech] ", " [steam tech] ", & " Bulleid's CI� CC1- More
Details", of which only the last is the one you're interested in. So you
might do something like this...
--=================================================
set oldSubj to "[steam tech] Re: [steam tech] Re: Bulleid's CI� CC1-
More Details"
set TIDs to AppleScript's text item delimiters
set AppleScript's text item delimiters to "Re:"
set newSubj to "Re:" & text item -1 of oldSubj
set AppleScript's text item delimiters to TIDs
newSubj --> "Re: Bulleid's CI� CC1- More Details"
--=================================================
(Any lines that abut the left margin of the message window have been wrapped
and should be re-connected to the end of the previous line.)
You've presented Paul with quite a shopping list of subject line formats
that you want to fix, but armed with the power of TIDs you should be able to
build your own scripts to handle even the most labyrinthine combinations of
reply & forwarding prefixes.
You�ve already identified the subject lines you want to change and the
elements you want to remove. The next stage would be to put all the unwanted
elements in a list (eg: { "Re:", "Fwd", "(Steam_Tech)"}), and loop through
this, setting AS's TIDs to each item in turn. (Note that AppleScript is case
insensitive � unless you tell it otherwise � so "Re:" and "RE:" will be
treated as equal.)
In most cases all you will need to do is check if the subject line being
processed contains the currently active TID, and if it does, change it to
"Re:" & text item -1 (the last text item) of the original subject.
Have fun, and watch out for 'gotchas'.
Nick
pp Mr Tea
--
--
To unsubscribe:
<mailto:[EMAIL PROTECTED]>
archives:
<http://www.mail-archive.com/entourage-talk%40lists.letterrip.com/>
old-archive:
<http://www.mail-archive.com/entourage-talk%40lists.boingo.com/>