How do I read specific colon delineated text from a file?

I am very new to AppleScript. I’m sure this can be done, but I couldn’t find a specific example on these forums.
What I am trying to do is simple. I have a text file that contains colon delineated text items. I want my script to read these items individually. For example I would like to set the variable “userName” to item 1 in my file list, or set “phoneNum” to item 4, etc…

Any help would be greatly appreciated!


Model: MacPro
AppleScript: 2.3
Browser: Firefox 4.0.1
Operating System: Mac OS X (10.6)

Use AppleScripts text item delimiters.


set myText to "first_name:last_name:phone_number:street"

set old_delims to AppleScript's text item delimiters
set AppleScript's text item delimiters to ":"
set the_list to every text item of myText
set AppleScript's text item delimiters to old_delims
get the_list

will return {“first_name”, “last_name”, “phone_number”, “street”}.