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:
Mark Lively <[log in to unmask]>
Reply To:
Macintosh Scripting Systems <[log in to unmask]>
Date:
Thu, 22 May 2008 11:11:42 -0400
Content-Type:
text/plain
Parts/Attachments:
text/plain (32 lines)
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

-Mark
Wondering why the hell it was taking so long to run.

ATOM RSS1 RSS2