Re: Getting started with XML?
Re: Getting started with XML?
- Subject: Re: Getting started with XML?
- From: kai <email@hidden>
- Date: Wed, 7 Feb 2007 18:44:12 +0000
On 7 Feb 2007, at 17:56, Michelle Steiner wrote:
On Dec 7, 2006, at 3:10 PM, Christopher Nebel wrote:
Don't forget that if the XML file you're dealing with is a plist,
then you ought to be using the Property List Suite instead. It's
easier to work with, and there's no guarantee that a plist is XML.
As it turns out, it is a plist, although the file extension
is .xml. It's a playlist from iTunes.
property plistFile : missing value
if plistFile is missing value then set the plistFile to choose file
tell application "System Events"
set foo to contents of property list file (path of plistFile)
properties of property list item "tracks" of foo
end tell
This gives me a list of all the data in the file, but I can't
figure out how to extract that data.
If I change properties to |name|, I get...
[snip]
Try something along these lines, Michelle:
------------------
property plistFile : missing value
if plistFile is missing value then set plistFile to (choose file of
type ¬
"public.xml" default location (path to music folder) without
invisibles)
tell application "System Events" to set name_list to value of ¬
property list item "Name" of property list items of ¬
property list item "Tracks" of property list file (plistFile's path)
------------------
Change the "Name" label for some other type of value (such as "Total
Time", "Year", "Library Folder Count", "Bit Rate", "Play Count",
"Track Type", "Disc Number", "Genre", "Disc Count", "Composer",
"Track Count", "Artist", "Date Modified", "Track Number", "Persistent
ID", "File Creator", "Location", "File Type", "Sample Rate", "File
Folder Count", "Play Date", "Track ID", "Play Date UTC", "Date
Added", "Album", "Kind" or "Size").
To get a list of possible 'types' like the above, use something like:
------------------
tell application "System Events" to set type_list to name of ¬
property list items of property list item 1 of ¬
property list item "Tracks" of property list file (plistFile's path)
------------------
---
kai
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/mailman//archives/applescript-users
This email sent to email@hidden