iTunes Help

Posted on
Wed Jan 14, 2009 2:12 pm
BillC offline
Posts: 237
Joined: Mar 09, 2008

(No subject)

The only way I've found so far to get the -1728 error is to have an incorrect userid or password.

127.0.0.1 works (obviously, and for lurkers, if both Indigo Server and the account whose iTunes you are trying to control are on the same computer).

A space in the user name won't work, but you can substitute "%20" for the space.

Interestingly, to test this I changed a long user name (first name only) by adding a space and last initial. That's how I found that space threw an error and the %20 worked. Another script with the old user name also worked. Eight letters in the first name. So maybe only the first eight (or fewer) characters are significant.

Short user name should work, period, so you may have a password error. Try with 127.0.0.1 to eliminate that variable (you get a different error with a bad machine name, though).

Posted on
Wed Jan 14, 2009 11:28 pm
Dino-Two offline
Posts: 22
Joined: Jan 12, 2009
Location: AZ

(No subject)

Hi Bill,

I played with your suggestion for quite a while but couldn't make it go. The script executes in the account where the Indigo server is running, right? And iTunes is running in my account so the script contains my user name and password, right?

An attempt to talk to iTunes on my wife's computer with this script
Code: Select all
tell application "iTunes" of machine "eppc://jfrison:xxxxx@Julia-Frisons-MacBook-Pro.local"
returned "Remote access isn't allowed."

Carroll

Posted on
Thu Jan 15, 2009 2:57 am
dtich offline
Posts: 798
Joined: Sep 24, 2005

(No subject)

you need to enable remote login in sys prefs/sharing.. perhaps also remote management.. can't remember. fwiw.

Posted on
Thu Jan 15, 2009 5:38 am
BillC offline
Posts: 237
Joined: Mar 09, 2008

(No subject)

Dino-Two wrote:
The script executes in the account where the Indigo server is running, right? And iTunes is running in my account so the script contains my user name and password, right?


That's correct. That's essentially what I'm doing; I have a "Home Automation" account where Indigo Server runs, and a user account "Bill" where I'm accessing iTunes, on the same computer.

My "Tell" line reads:
Code: Select all
tell application "iTunes" of machine "eppc://Bill:xxxxxxxx@127.0.0.1"


Dino-Two wrote:
An attempt to talk to iTunes on my wife's computer with this script
Code: Select all
tell application "iTunes" of machine "eppc://jfrison:xxxxx@Julia-Frisons-MacBook-Pro.local"
returned "Remote access isn't allowed."


Make sure that, on you're wife's computer, "Remote Apple Events" is checked in System Preferences ---> Sharing. (You don't need to enable remote login, that's for SSH).

Note that if the commanding computer (the one executing the script remotely) uses OS 9, you need to also open the "options" panel in Sharing ----> "Remote Apple Events" and enter the account password. I'm not that familiar with OS 9 so the "tell" line may need to be modified as well. If all your computers are running OS X, ignore this paragraph.

Posted on
Thu Jan 15, 2009 1:28 pm
dtich offline
Posts: 798
Joined: Sep 24, 2005

(No subject)

oh, remote events, that's it, right. is that all that needs enabling? hafta look on my server...

Posted on
Thu Jan 15, 2009 1:43 pm
Dino-Two offline
Posts: 22
Joined: Jan 12, 2009
Location: AZ

(No subject)

Bill,

It appears that in concept your setup is the same as ours. However, our iMac thinks that I am using a bad user name or password in the script. I have been using short user names as you suggested. On the remote chance that there was something goofy with the user names I changed this setting: System Prefs > Accounts > Login Options > Display login window as: Name and password, so that I would have to type in the user names. I was able to login by typing both the short and long user names.

So I probably have some check box checked in error ... or not checked....

On my wife's computer I had enabled Remote Apple Events. I had also read David Pogue's section on remote access in his Missing Manual: Mac OSX: Leopard Edition, and determined that I did not need to enable Remote Login.

Anyway, thanks for your suggestions ... also Matt & Jay, as you pointed me in the right direction. Maybe someday I'll figure this out.... Hee, hee....

Carroll

Posted on
Sun Jan 10, 2010 8:57 am
hamw offline
Posts: 1212
Joined: Mar 31, 2008

(No subject)

I was looking for a way to shuffle iTunes so it would start on a random first song. Tried this script on one of my playlists as seen below. iTunes goes to the proper playlist. When the shuffle action executes, it switches to the last playlist in the column (current playlist 'untitled playlist 3'), and starts the first track every time on that playlist, eg no shuffle even on that one. I deleted that particular playlist, and it then went to what was now the last playlist on the bottom.



Received INSTEON "Fam Rm Ir-Link" start brighten (button 34)
Received INSTEON "Fam Rm Ir-Link" stop brighten (button 34)
Trigger Action iTunes PList 7 Ham 34b
iTunes Attachment start playlist iTunes PList 7 Ham
Trigger Action Shuffle iTunes
iTunes Sync current track 'Ball Out ($500)'
iTunes Sync current artist 'Blak Jak'
iTunes Sync current album 'Place Your Bets'
iTunes Sync current playlist 'untitled playlist 3'

Any further insight? I am running Indigo on a dedicated mac with admin privileges.

Posted on
Sun Jan 10, 2010 10:06 am
matt (support) offline
Site Admin
User avatar
Posts: 21411
Joined: Jan 27, 2003
Location: Texas

(No subject)

I don't have a direct answer, but if you haven't yet you should check out Doug's AppleScripts web site. Searching on "shuffle" on his site brought up quite a few scripts, and I suspect your answer might be in one of those.

Image

Posted on
Sun Jan 10, 2010 11:29 am
BillC offline
Posts: 237
Joined: Mar 09, 2008

(No subject)

@hamw, not sure what script you're running. I use a separate linked script to start each playlist. The following plays my playlist "Cabaret" in shuffle mode:

Code: Select all
tell application "iTunes"
   set IndigoPlaylist to "Cabaret"
   reveal playlist "Music"
   reveal playlist IndigoPlaylist
   set shuffle of playlist IndigoPlaylist to false
   set shuffle of playlist IndigoPlaylist to true
   play playlist IndigoPlaylist
end tell


There are a couple of perhaps unneeded steps...the "reveal" lines ensure that the focus is correct, the double set shuffle lines fixed a glitch where iTunes would not start in shuffle mode if I just used "set to true". These are kludges that should be fixed if I ever get around to it...in the meantime, they work.

Posted on
Sun Jan 10, 2010 11:52 am
jay (support) offline
Site Admin
User avatar
Posts: 18200
Joined: Mar 19, 2008
Location: Austin, Texas

(No subject)

hamw wrote:
I was looking for a way to shuffle iTunes so it would start on a random first song. Tried this script on one of my playlists as seen below. iTunes goes to the proper playlist. When the shuffle action executes, it switches to the last playlist in the column (current playlist 'untitled playlist 3'), and starts the first track every time on that playlist, eg no shuffle even on that one. I deleted that particular playlist, and it then went to what was now the last playlist on the bottom.



Received INSTEON "Fam Rm Ir-Link" start brighten (button 34)
Received INSTEON "Fam Rm Ir-Link" stop brighten (button 34)
Trigger Action iTunes PList 7 Ham 34b
iTunes Attachment start playlist iTunes PList 7 Ham
Trigger Action Shuffle iTunes
iTunes Sync current track 'Ball Out ($500)'
iTunes Sync current artist 'Blak Jak'
iTunes Sync current album 'Place Your Bets'
iTunes Sync current playlist 'untitled playlist 3'

Any further insight? I am running Indigo on a dedicated mac with admin privileges.


Are you using the iTunesStartPlaylist(plist, rnd) handler from the iTunes attachment? It should do what you're looking for. Although, granted, I believe the first song is always the first song based on the sort order of the playlist in the iTunes UI.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Sun Jan 10, 2010 1:00 pm
hamw offline
Posts: 1212
Joined: Mar 31, 2008

(No subject)

Figured it out. Here's the script. It selects the playlist and then FFs to the next song. Apparently the first song is always the same so the FF will have the plist force iTunes to start on a different song.

tell application "iTunes"
    set shuffle of playlist "playlist name" to true
    set song repeat of playlist "playlist name" to all
    play playlist "playlist name"
end tell
iTunesFF()

Works like a charm; no other action item is necessary.

Edit: just now noted the set shuffle comments- will put those in if it gets buggy. Otherwise this seems to do the trick. The issue of the shuffle script going to the last playlist was because that was what the script was telling it to do. See the script in the beginning of the thread.

Posted on
Sun Jan 10, 2010 1:38 pm
jay (support) offline
Site Admin
User avatar
Posts: 18200
Joined: Mar 19, 2008
Location: Austin, Texas

(No subject)

hamw wrote:
Figured it out. Here's the script. It selects the playlist and then FFs to the next song. Apparently the first song is always the same so the FF will have the plist force iTunes to start on a different song.

tell application "iTunes"
    set shuffle of playlist "playlist name" to true
    set song repeat of playlist "playlist name" to all
    play playlist "playlist name"
end tell
iTunesFF()

Works like a charm; no other action item is necessary.

Edit: just now noted the set shuffle comments- will put those in if it gets buggy. Otherwise this seems to do the trick. The issue of the shuffle script going to the last playlist was because that was what the script was telling it to do. See the script in the beginning of the thread.


Pretty much what iTunesStartPlaylist does, except w/o the extra fast-forward.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Sun Jan 10, 2010 4:40 pm
gregconnors offline
Posts: 22
Joined: May 10, 2008
Location: Mayfield, Australia

(No subject)

There are several different ways to do the random thing. What works for me is 'play some track'.

Code: Select all
   tell application "iTunes"
      set chosenPlaylist to user playlist "Chill"
      set visible of front browser window to true
      set view of front window to chosenPlaylist
      set shuffle of chosenPlaylist to true
      set song repeat of chosenPlaylist to all
      play some track of chosenPlaylist
   end tell


Hope it helps.

PS. This is my first contribution. Hope I can give back the way so many others do. Great to be a part of the Indigo community :)

Posted on
Sun Jan 10, 2010 5:16 pm
hamw offline
Posts: 1212
Joined: Mar 31, 2008

(No subject)

Greg, I too feel a warm fuzzy having helped in my own small way. I like the "set window to chosen playlist"- I was hoping to get that to happen.

Posted on
Sun Jan 10, 2010 5:33 pm
dtich offline
Posts: 798
Joined: Sep 24, 2005

(No subject)

i do this:

Code: Select all
if myitunesCmd is "shuffle" then
                     tell application "iTunes"
                        stop
                        set view of front browser window to playlist "ITunes DJ"
                        play
                     end tell
                  else


used to be playlist "Shuffle" but apple changed it to iTunes DJ a couple versions back.. as we all know. this is part of my original itunes handler, i never changed over to the one jay incorporated into indigo as mine always worked great for me. obviously you can also just 'shuffle' the main playlist 1, which i used to do, but itunes dj works better for me i found. 2¢.

Who is online

Users browsing this forum: No registered users and 5 guests