MACSCRPT Archives

May 2008

MACSCRPT@LISTSERV.DARTMOUTH.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Chuck Pelto <[log in to unmask]>
Reply To:
Macintosh Scripting Systems <[log in to unmask]>
Date:
Thu, 22 May 2008 09:54:31 -0600
Content-Type:
text/plain
Parts/Attachments:
text/plain (42 lines)
Wowzers!

On May 22, 2008, at 9:11 AM, Mark Lively wrote:

> On May 22, 2008, at 11:06 AM, Mark Lively wrote:
>
>> Not easily.  Its long been a problem that Apple Apps have crappy  
>> dictionaries.
>>
>> tell application "iTunes" to set albumlist to album of every track  
>> of playlist "Foo"
>> set tid to AppleScript's text item delimiters
>> set AppleScript's text item delimiters to linefeed
>> set albumlist to albumlist as text
>> set lun to open for access POSIX file "/tmp/foo" with write  
>> permission
>> write albumlist to lun
>> close access lun
>> do shell script "sort -m /tmp/foo >/tmp/foo2"
>
> Silly me.  sort -u not -m
>
>>
>> set albumlist to read ("/tmp/foo2" as POSIX file)
>> set albumlist to every text item of albumlist
>> set AppleScript's text item delimiters to tid
>> do shell script "rm -f /tmp/foo /tmp/foo2"
>> set tracklist to {}
>> repeat with anAlbum in albumlist
>> 	tell application "iTunes" to set tracklist to tracklist & (name  
>> of every track of playlist "Foo" whose album is anAlbum)
>> end repeat
>> tracklist

That's considerably more complicated than I thought it should be.

THANKS!

Regards,

Chuck

ATOM RSS1 RSS2