| Author |
Message |
|
doctorlambo
Joined: Dec 08, 2005 Posts: 31
|
 Remote iTunes Automation **IMPROVED 2/4/06
- Code: Select all
----By Ian Dopps 2006 ----This script will allow you to email your computer and control itunes. It works great when integrated with Indigo. To use, type the word "itunes" in the subject box. Now, you need to type in the body of the message. In the body, ONLY type the name of the artist on line 1 and ONLY the track number on line 2. If you do not type the track number in, it will start at the first track of the artist. If you want to hear a playlist instead of a specific artist, type "playlist" on line 1 and then the name of the playlist on line 2. This script also supports AirTunes playing. If you want to toggle AirTunes on or off, type "remote" on line 3. Unfortunatly, Itunes has poor GUI and networking script capabilities at this time. Therefore, if you decide to use the AirTunes feature, you need to download the script addition called "Extra Suites". It can be found at http://www.macupdate.com/info.php/id/9730 ---Have fun! QUESTIONS? doctorlambo@gmail.com -------------- tell application "Mail" activate delay 1 check for new mail tell (first message of inbox whose subject is "itunes") to if exists then try set target_track to first paragraph of (get content) on error set target_track to "playlist" end try if target_track is "playlist" then try set track_number to second paragraph of (get content) as text on error set track_number to "library" end try else try set track_number to second paragraph of (get content) as number on error set track_number to "1" end try end if try set remote_computer to third paragraph of (get content) on error set remote_computer to 0 end try if track_number is 0 then set track_number to 1 end if tell application "Mail" delete (first message of inbox whose subject contains "itunes") end tell --------------------------------- if remote_computer is "remote" then ---REMOTE SPEAKER TOGGLE tell application "iTunes" activate delay 2 set visible of window "remote speakers" to true delay 1 set {X, y} to position of window "remote speakers" tell application "Extra Suites" ES move mouse {X + 15, y + 57} ES click mouse end tell delay 1 close window "remote speakers" end tell end if --------------------------------- if target_track is "playlist" then tell application "iTunes" activate delay 2 tell (playlist track_number) to if exists then tell application "iTunes" to play (playlist track_number) else tell application "iTunes" to play (playlist "library") end if end tell else tell application "iTunes" activate delay 2 set X to number of (tracks of library playlist 1 whose enabled is true and artist is target_track) if X is less than track_number then set track_number to 1 end if tell (track track_number of library playlist 1 whose enabled is true and artist is target_track) to if exists then tell application "iTunes" to play (track track_number of library playlist 1 whose enabled is true and artist is target_track) else tell application "iTunes" to play (playlist "library") end if end tell end if ---------- end if end tell
Last edited by doctorlambo on Sat Feb 04, 2006 11:10 pm, edited 3 times in total.
|
| Thu Dec 15, 2005 10:05 pm |
|
 |
|
matt (support)
Site Admin
Joined: Jan 27, 2003 Posts: 11692 Location: Texas
|
 Re: Here is a fun script I made
Great! Thanks for sharing.
Matt
|
| Fri Dec 16, 2005 8:13 pm |
|
 |
|
doctorlambo
Joined: Dec 08, 2005 Posts: 31
|
updated 1/29/06. Can now tell it what track to play! See code and code instructions.
updated on 1/2/06. I made the script work without needing the user to put any personal information in the script.
updated 1/4/06. Can now tell an AirTunes Base to toggle on or off. Must download "Extra Suites" for this.
If you decide to use this, remember one thing. It accesses your normal email account on your mac, while indigo might be accessing a different account. Because of this, you may want to change some preferences in your email accounts. I suggest that you make your mac check email every 1 minute, and Indigo every 3 or more minutes. The important thing is to make sure that Indigo does not run the script before the email gets to your macs email account, because that is where the specific instructions are contained. This is not neccessary, but it will help. Also, I have my programs checking my email on a frequent basis. If you are away from home and want to trigger an action like turning your video on, you dont want to wait forever for Indigo or your mac email to check for the message.
Last edited by doctorlambo on Sat Feb 04, 2006 11:13 pm, edited 1 time in total.
|
| Sun Jan 01, 2006 7:40 pm |
|
 |
|
jmoskal
Joined: Feb 01, 2006 Posts: 5 Location: MI
|
 Remote Speakers
Great script. Any idea how I could tell iTunes to play music to a specific set of speakers? I use an Airport Express in the master bedroom and would like to tell iTunes to play to this location v. the local computer. Thanks in advance.
|
| Wed Feb 01, 2006 12:19 pm |
|
 |
|
doctorlambo
Joined: Dec 08, 2005 Posts: 31
|
Let me look into that. I will post it here when I figure it out. Ian
|
| Thu Feb 02, 2006 12:24 am |
|
 |
|
jmoskal
Joined: Feb 01, 2006 Posts: 5 Location: MI
|
 Thanks
One more thing (now I'm being greedy  )...any way to tell iTunes to play a specific playlist instead of an artist and song? Thanks again. I'm just getting into this stuff again and it is so much better than it used to be.
|
| Thu Feb 02, 2006 11:22 am |
|
 |
|
doctorlambo
Joined: Dec 08, 2005 Posts: 31
|
Yeah, I can do that too. I will post it here when I finish it. I have it so that it will play over the network, but I still changing a couple things. Are you trying to play your music on a network computer or AirTunes?
|
| Fri Feb 03, 2006 1:15 pm |
|
 |
|
jmoskal
Joined: Feb 01, 2006 Posts: 5 Location: MI
|
I'm using AirTunes. Thanks a million.
|
| Fri Feb 03, 2006 10:04 pm |
|
 |
|
doctorlambo
Joined: Dec 08, 2005 Posts: 31
|
jmoskal,
The code above is what you were needing. Just read the diections in the code. It will play artists or playlists now. It will toggle the Airtunes on or off also. Unfortunatly, network scripting in tunes is really poor. In addition AirTunes and Remote Speakers are 100% un-scriptable. So, I had to throw in a script edition called "Extra Suites". It allows you to manipulate the un-scriptable to an extent. So, just go to the website I listed in the code and download it. After you do, you should be able to use the AirTunes. Inserting the word "remote" on the third line will either turn it on or off. You do not have to use this feature, but it is there for use if you like. I hope this helps. If you have questions or trouble, just email me to that address in the code instructions.
|
| Sat Feb 04, 2006 11:21 pm |
|
 |
|
mreyn2005
Joined: Oct 06, 2006 Posts: 60
|
 airtunes and multi-zone audio
So this has been something I have thought a bit about in the last year or two just trying to think how it could be done.
My best thought was to download/buy Airfoil 3 (< $30) which works with airport expresses to distribute ANY sound on your mac to speakers attached to said airports. Enabling or disabling airport destinations is AppleScript-able in Airfoil.
This could be pretty handy if its as easy as I think it might be. In this scenario, you could have an audio control page that lets you select which zones were active for indigo audio sound output including indigo spoken commands and such. For music, just use iTune scripts for indigo and press play!
someone want to tell me they have already done this? (I realize this post is older now)
someone want to try this?
mreyn2005
|
| Fri Mar 21, 2008 7:25 pm |
|
 |
|
skibby
Joined: Mar 09, 2008 Posts: 13
|
mreyn2005, I was looking at doing exactly that a few days ago. I'm going to write a little code this weekend and see what I come up with.
I'm trying to get "follow-me" audio working though. Supposedly Airfoil has awesome support for Applescript so should work OK. If I come up with something I'll make a new post though so we don't clutter this one up too much.
|
| Sat Mar 22, 2008 6:20 am |
|
|