I got a plist file like this form:
<dict>
<key>items</key>
<array>
<dict>
<key>key</key>
<string>value</string>
</dict>
</array>
</dict>I want to read value .
And my apple script like this:
tell application "System Events"
tell property list file "/Users/sun/Desktop/exp.plist"
set p1 to the value of property list item "items"
repeat with i from 1 to number of items in p1
set p2 to the value of property list item "key" of property list item i of p1
return p2
end repeat
end tell
endtellbut i got an error like this :can not get “property list item 1 of {{|key|:"value"}}”。
what can i do to correct this?
Thanks a lot .
The problem here is that you an array in the mix. What you’re trying to do here is the equivalent of:
property list item "key" of property list item "items"and what you want to do is:
property list item "key" of property list item 1 of property list item "items"Share and Enjoy
—
Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware
let myEmail = "eskimo" + "1" + "@apple.com"