TRying to read a plist item in an array and failing miserably.

As one example, I have an array in a plist that contains state abbreviations and the expanded name and just in general, I’d like to know how to read a plist with a format of Root>Array>Dictionary>String, String, String . . . and not just Root>Array>String, String, String . . .
Here’s a sample of the PList:

set pathToPList to ((path to desktop folder) & "StateAbreviationsExpanded.plist") as text
tell application "System Events" to set expandedState to the value of property list item "States" of property list file pathToPList

And with this this bit of script I can get a list with all the items in the array, but can’t figure out how to directly read deeper in so I can call the abbreviation and get the associated value back. I already have some data files stored in basically flat, but just to keep the data files internally organized better as they grow.

Thanks,
–Mark

Model: MacBook
AppleScript: 2
Browser: Safari 525.18
Operating System: Mac OS X (10.5)

Hi,


set pathToPList to ((path to desktop folder as text) & "StateAbreviationsExpanded.plist")
tell application "System Events" to set expandedState to value of property list items of property list item 1 of property list items of contents of property list file pathToPList

and for one item


set pathToPList to ((path to desktop folder as text) & "StateAbreviationsExpanded.plist")
set text item delimiters to {""}
tell application "System Events" to set Arizona to value of property list item "AZ" of property list item 1 of property list items of contents of property list file pathToPList as text

Thanks for pointing me in the right direction. I got the result I want with the current PList file using this:


on ExpandStateAbreviation(stateToExpand)
	set pathToPList to ((path to desktop folder) & "StateAbreviationsExpanded.plist") as text
	tell application "System Events" to set expandedState to value of property list item stateToExpand of property list item 1 of property list items of contents of property list file pathToPList
	return expandedState
end ExpandStateAbreviation

So now I feed the 2 letter abbreviation to the variable “stateToExpand” and it returns the full name. WooHoo.
But when I put the data into the PList where I’m going to be accessing from, it again fails.

I’m just having trouble with how to figure out the correct syntax for getting down into the various nested elements in the XML structure.