Re: One Finder and one iTunes Question?
Re: One Finder and one iTunes Question?
- Subject: Re: One Finder and one iTunes Question?
- From: Doug Adams <email@hidden>
- Date: Tue, 8 Apr 2008 09:50:39 -0400
On 08-04-08, at 00:49, Dave wrote:
2. How can I get the location of the music folder as set in the
iTunes Preference panel?
set path_to_designated_music_folder_posix to my get_music_folder()
set path_to_designated_music_folder_alias to POSIX file
path_to_designated_music_folder_posix
to get_music_folder()
set theCommand to ("perl -e 'local $/ = undef;my $s = <>;while ($s=~m|
<key>Music Folder</key><string>(.*?)</string>|sg) {$v = $1;$v =~ s/\\%
([a-fA-F0-9]{2,2})/chr(hex($1))/seg;$v =~ s|file://localhost||;print
$v;}' " & my get_path_to_current_xml())
return do shell script theCommand
end get_music_folder
to get_path_to_current_xml()
set o to (do shell script "defaults read com.apple.iApps
iTunesRecentDatabasePaths") as string
set xm to text ((offset of "\"" in o) + 1) through ((offset of ".xml"
in o) + 3) of o
return (my replace_chars(xm, " ", "\\ ")) as string
end get_path_to_current_xml
on replace_chars(txt, srch, repl)
set AppleScript's text item delimiters to the srch
set the item_list to every text item of txt
set AppleScript's text item delimiters to the repl
set txt to the item_list as string
set AppleScript's text item delimiters to ""
return txt
end replace_chars
Cheers,
Doug
--
Doug's AppleScripts for iTunes
http://dougscripts.com/itunes/
RSS feed:
http://dougscripts.com/itunes/dougs.rss
30 Most Recent Scripts:
http://dougscripts.com/itunes/dougsupdated.rss
Mail & iChat/AIM:
email@hidden
_______________________________________________
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/archives/applescript-users
This email sent to email@hidden