nick_harambee

Q: Scripting creation of smart playlists in iTunes

Hi,

 

I am exploring the possibility of scripting the creation of smart playlists in iTunes.  As I understand it this can only be achieved with GUI scripting.  I have come across a couple of threads which suggest this can be achieved:

 

https://discussions.apple.com/thread/20 … p;tstart=0

 

http://macscripter.net/viewtopic.php?id=9967

 

however both generate an error for me.  The problem appears to be around the line "tell scroll area 1 of group 1 of window 1".  I get the error:

 

System Events got an error: Can't get group 1 of window 1 of process "iTunes". Invalid index.

 

I wonder if someone could help me get this working?

 

Thanks,

 

Nick

Macbook Pro, Mac OS X (10.7), 2.66 GHz Intel Core i7 8GB RAM

Posted on May 6, 2012 3:07 AM

Close

Q: Scripting creation of smart playlists in iTunes

  • All replies
  • Helpful answers

first Previous Page 3 of 3
  • by nick_harambee,

    nick_harambee nick_harambee May 8, 2012 9:35 AM in response to twtwtw
    Level 1 (5 points)
    May 8, 2012 9:35 AM in response to twtwtw

    Thanks twtwtw.  That works fine, and thanks for the info about posting etiquette.  Makes sense to me. 

     

    The only problematic issue still with the script is the keystrokes for the renaming of the playlists.  Sometimes it doesn't rename them at all and sometimes with only part of the text (and sometimes it's fine).  Sometimes text is entered rapidly, all at once, and at other times, one letter at a time. I have tried experimenting with adding delays, in case this is relevant, and have found that adding a delay between "keystroke theLabel" and "return" helps, but it's certainly not fullproof.

     

    I thought the issue might be related to a problem I am experiencing with entering text generally (which I have experienced since upgrading to Lion), in that my Mac is not always very responsive and sometimes enters the first character in the wrong place.  But as the keystroke for the text entered into the smart playlist window is working 100% of the time, it would seem that the issue is not related to this.

     

    Nick

first Previous Page 3 of 3