Re: TIDs info summary
Re: TIDs info summary
- Subject: Re: TIDs info summary
- From: Paul Skinner <email@hidden>
- Date: Sat, 9 Nov 2002 23:09:54 -0500
On Saturday, November 9, 2002, at 02:18 PM, bill fancher wrote:
On Friday, November 8, 2002, at 11:05 AM, Paul Skinner wrote:
snip
2. ASLG p.210:You may want to use an error handler to reset the Text
Item Delimiters property to its former value if an error occurs.
( In several places it is suggested that one reset the TIDs after
changing them. Only in the most simplified example scripts are they
changed and not reset. )
The only relevant mention I can find is the one you quote here, which
I'd wouldn't call a suggestion to reset tid's. Did I miss something?
My parenthetical statement was not factual, it was my impression after
reading the text. If you feel that...
2. ASLG p.210:You may want to use an error handler to reset the Text
Item Delimiters property to its former value if an error occurs.
...Is not a sggestion to reset TIDs, then we may have a language issue.
It doesn't matter to me. It isn't the suggestive text of the ASLG that
made me adopt storing and restoring the TIDs. Read on.
snip
3. ( my own ) Storing and restoring the TIDs is pointless if you
specifically set them before each use.
Blasphemy! (Welcome brother.)
: )
UNLESS you use handlers or loaded scripts or run script
constructions. If you use any of these language features then it
becomes important to store and restore the current TIDs within them
in order to prevent these constructions from invisibly and perhaps
unexpectedly altering the TIDs and generating unexpected results in
the main script.
I might have said: If you do those things, then afterwards it's
important to set tid's appropriately before using them.
I should not have left you ANY room to squirm.
The only situation that I have ever encountered where this is not an
option is calling a handler as an argument to another handler. In this
situation you cannot control the TIDs value between handler calls.
This single argument was sufficient to cause me to rework all of my
handlers to store and restore. it may not be sufficient for you or
anyone else.
The following example script uses two nested handlers. AsciiSort and
GetHREFs. Both of these handlers change the TIDs to do work, both of
them store and restore the TIDs. If they did not, this would break and
require more lines to accomplish the same functions.
set AppleScript's text item delimiters to "/"
text item -1 of (item 1 of (AsciiSort(GetHREFs((read file ((choose
file) as text))))))
-->"radio.weblogs.com:0103146:.webloc"
Would you agree that in THIS case I needed to store and restore the
TIDs?
I don't think that anyone here has suggested that this is not the
case. Not even Bill with his rebelious TIDs scofflaw ways.
I hope I've rectified that oversight.
--
bill
Maniacally, ; )
--
Paul Skinner
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.