setting text item delimiters

I thought I had this figured out but setting text item delimiters is giving me fits. I have the following:

set AppleScript's text item delimiters to {";"}

What I want is for “;” to be the ONLY delimiter. However, even after this statement when I do:

set address to words 4 thru -1 of vcardline

The items in “address” seems to be using not only “;” but also “:”, “=” and space as delimiters. What am I doing wrong? TIA.

text item delimiters affects only text items, not words, characters or paragraphs


set ASTID to AppleScript's text item delimiters
set AppleScript's text item delimiters to ";" -- a list is not necessary
set address to text items 4 thru -1 of vcardline
set AppleScript's text item delimiters to ASTID

Notes:
¢ It’s always recommended to save and restore the previous value of text item delimiters
¢ AppleScript’s is only needed in a tell block

DOH! Thanks for the reply. I spotted what I did shortly after posting this.

gw:

Using words can be good or bad,depending on the situation. One thing to keep in mind is that some punctuation is a word and some isn’t.


set m to " ! @ # $ % ^ & * (  ) - _ = + [ { ] } ; : ' , < . > / ?` ~ "
words of m

-- Returns:  {"@", "#", "$", "%", "^", "&", "*", "_", "=", "+", "<", ">", "`", "~"}

So if you’re getting a strange (or unexpected) word count, check for punctuation.

Jim Neumann
BLUEFROG

Hello!

I am having a question, with regard to text item delimiters, I know it may look kind of superfluos but I like certainity and I haven’t really found the answer any place.

it is with regard to my and Applescript’s text item delimiters

The difference between the two is just the scope right?

And this must also work, so that the latest set in my script, is the one applied?

This I can easily figure out for myself and I have done so.

set fruits to {"apples", "pears", "Strawberries", "pineapple", "mango"}
set tids to my text item delimiters
set my text item delimiters to " "
set txt to fruits as text
log txt
-- > (*apples pears Strawberries pineapple mango*)
set AppleScript's text item delimiters to ";"
set txt to fruits as text
log txt
-- >(*apples;pears;Strawberries;pineapple;mango*)
log "my text item delimiters : >" & my text item delimiters & "<"
-->(*my text item delimiters : >;<*)
set my text item delimiters to "*"
log "AppleScript's text item delimiters : >" & AppleScript's text item delimiters & "<"
-->(*AppleScript's text item delimiters : >*<*)
set my text item delimiters to tids --! :)

Edit
I am having second thoughts about this, as I concluded the test above by setting back the text item delimiters of both my and AppleScript’s in one go, I am not so sure anymore if this is how this works, maybe I am just having a local copy, so I should set them back proberly by


set AppleScript's text item delimiters to tids ” !

then I was wondering about the objective about doing it like jonn8 does:


tell a refence to my text item delmitiers 
set tids to its contents
set its contents to ";" ” (for instance)

” do my stuff here
end tell 

The conlusion to this construct, is that it will protect your tids from being overshadowed, by a script setting them running in parallell with yours, sort of “protecting your transaction”
Am I right in this?