import song to itunes from within Rev

Sarah Reichelt sarah.reichelt at gmail.com
Mon Feb 13 00:51:14 EST 2006


> I need to figure out how to import a song via script into iTunes from
> with in Rev. I assume the best approach is to use AppleScript and I
> can't figure it out, yet. I was also thinking there might be a way to
> do it straight in Rev.
>
> I think I am stuck on the filepaths in AS and the use of "as alias"
> and or " as string".
>
> My other commands are AS in Rev and work fine.
>
> Here is my AS script in a field in Rev:
> try
> tell application "Finder" to set thisitem to "Macintosh HD/Users/
> mcgrath3/Desktop/this will bw the day that i die.mp3" as alias
> tell application "iTunes"
> add thisitem
> end tell
> end try

As you suspected, the problem is with the file path. AppleScript uses
the old Apple file path delimiter ":" while Rev uses the Unix
delimiter "/". Also AppleScript requires the hard drive name to be
included in the path and Rev doesn't.

Your script will work fine if you change the /'s to :'s.

For changing back & forth, use the revMacFromUnixPath &
revUnixFromMacPath functions.

BTW, if you want to add the item to a specific playlist, you can
specify this in the "add" line e.g.
    add thisItem to playlist "Fav songs"

HTH,
Sarah



More information about the use-livecode mailing list