• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: One Finder and one iTunes Question?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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
  • Follow-Ups:
    • Re: One Finder and one iTunes Question?
      • From: Skeeve <email@hidden>
  • Prev by Date: Re: One Finder and one iTunes Question?
  • Next by Date: Re: Mail scripting…
  • Previous by thread: Re: One Finder and one iTunes Question?
  • Next by thread: Re: One Finder and one iTunes Question?
  • Index(es):
    • Date
    • Thread