Coerce string to list of items

I have one long string that looks like the quote below where successive parts are a date (sortable format), a 24-hour time, and a tide state.

I’d like this to be in the form shown below, but setting AS text item delimiters to “,” doesn’t seem to separate my string into items I can put in a list.

There must be a simple way to do this.


set theString to "20050501, 0451, High Tide 1.68 m, 20050501, 1220, Low Tide 0.33 m, 20050501, 1801, High Tide 1.57 m, 20050502, 0052, Low Tide 0.69 m, 20050502, 0602, High Tide 1.63 m, 20050502, 1320, Low Tide 0.31 m, 20050502, 1922, High Tide 1.63 m, 20050503, 0158, Low Tide 0.63 m, 20050503, 0721, High Tide 1.62 m, 20050503, 1418, Low Tide 0.29 m, 20050503, 2030, High Tide 1.73 m, 20050504, 0259, Low Tide 0.54 m, 20050504, 0834, High Tide 1.66 m, 20050504, 1513, Low Tide 0.27 m, 20050504, 2123, High Tide 1.83"
set AppleScript's text item delimiters to ","
set thelist to text items of theString
set AppleScript's text item delimiters to ""
get thelist

yields

You sure you typed correctly?
SC

Thanks, sitcom - I was doing precisely what you were, but using jj’s script properties because this is a huge list.

script TT
	property Tide : ""
	property NList : {} 

-- The previous line WAS THE PROBLEM. I had property Nlist : "" here.

end script
-- Put today's date in sortable format, e.g. 20050523
set today to current date
set yr to (year of today) as text
set mm to pad((month of today as number) as text)
set dd to pad((day of today) as text)
set iToday to yr & mm & dd
-- Open the tide table for Halifax
set HfxTides to alias "proper address here"
set HTRef to open for access HfxTides
set TT's Tide to (read HTRef)
close access HTRef
-- Get today's entries (4)
set AppleScript's text item delimiters to ","
set TT's NList to text items of TT's Tide
set AppleScript's text item delimiters to ""
TT's NList

-- etc. More to come

-- Handlers
on pad(k)
	if (length of k) = 1 then
		set kk to "0" & k
	else
		set kk to k
	end if
	return kk
end pad

Beware the dreaded typo!