 |
 |
Remote AppleScripting iTunes 2?
|
 |
|
 |
|
Mac Elite
Join Date: Sep 2000
Location: New York
Status:
Offline
|
|
Ok so now that iTunes 2 will be here any day now, lets start talking about what we can do with it. Wouldn't it be cool if we could have a small controller application for iTunes that would control iTunes 2 on a different machine? Then you can have one machine set up as an mp3 stereo and you could control it form any machine on the network, even cooler via airport. The dictionary for it is there, although I am a bit of an AppleScript idiot so I don't know how to do internet scripting, nor do I know how to make an entire Applescript application with windows and buttons and things.
However I am sure there are tons of people who would love to have such an application. Maybe called "iTunes Remote" or something. So basically, I'm asking who knows enough about applescript to get involved in this sort of thing. Do you think it would be better to wait until that new AppleScript Studio thing comes out? Any ideas?
|
|
|
| |
|
|
|
 |
|
 |
|
Mac Enthusiast
Join Date: Sep 2001
Location: McKinney, TX
Status:
Offline
|
|
Unfortunately, iTunes itself is not scriptable yet, not even with the advent of version 2 (I have the OS X version of iTunes 2).
|
|
|
| |
|
|
|
 |
|
 |
|
Grizzled Veteran
Join Date: Oct 2000
Location: Vancouver
Status:
Offline
|
|
Originally posted by TheBum:
<STRONG>Unfortunately, iTunes itself is not scriptable yet, not even with the advent of version 2 (I have the OS X version of iTunes 2).</STRONG>
Not true...
next track: advance to the next track in the current playlist
next track
openURL: connect to a remote audio source
openURL text
pause: pause playback
pause
play: play the current track or the specified track or file.
play reference -- item to play
previous track: return to the previous track in the current playlist
previous track
stop: stop playback
stop
All worked perfect for me with my limited AppleScript ability...
|
|
|
| |
|
|
|
 |
|
 |
|
Mac Elite
Join Date: Sep 2000
Location: New York
Status:
Offline
|
|
Yea I have a bunch of keyboard shortcuts set up on my PowerBook. From any app I can do the following:
fn -> next track
fn <- previous track
cmd-space play/pause
What I would really like it to be able to control my PowerBook from my iBook but I don't know the first thing about AppleScript over IP. Infact my AppleScript knowledge in general is pretty limited. Sal said that there was going to be some sample scripts posted for iTunes 2 but there's nothing up on Apple's site.[
|
|
|
| |
|
|
|
 |
|
 |
|
Mac Elite
Join Date: Sep 2000
Location: New York
Status:
Offline
|
|
I did it!! It's so easy! I now LOVE AppleScript! I now can lie on my back in bed using my new iBook while my Pismo sits on my desk churning out tunes via iTunes and my soundsticks, and I can control it ALL from the iBook! I have those same shortcuts now working (using ctrl instead of fn or cmd) and it really works! If anyone wants these scripts I will post them, but in all honesty this stuff is extremely easy. I just did it all in 5 minutes. It took me more time to find an example since I couldn't get the AppleScript guidebook to install in classic, but I just searched through the files until I found an example. I am really impressed with how easy Apple has made it to automate your Mac. I really don't know anything about AppleScript and I picked this up in minutes. AppleScript is cool.
I'm too lazy to figure out how to get the name of the current song to show up on the iBook or to see the playlist or anything. It would be cool if I could make an entire "iTunes Remote" app but I am wayy to lazy, and I would probably need that new authoring environment to create an interface for it. Still, this is all just too cool.
|
|
|
| |
|
|
|
 |
|
 |
|
Grizzled Veteran
Join Date: Apr 2000
Location: New York City
Status:
Offline
|
|
Sounds great- I have a G4 tower in my bedroom, with audio out cables through the wall to the stereo in the living room, but now I have to start the music, then change rooms. I would love to use my airport wallstreet in the living room to change the music-
***Can anyone make this 'app' that would allow song names, changing playlists etc remotely???? It sounds like applescript could do it - heck I'd PAY for it....
Lee
|
|
iPhone 3G 16Gb
24" 2.8Ghz Core 2 Duo iMac, 4GB/320GB/256MB
12" AlBook 1Ghz/768Mb/80Gb/Combo/AX
|
| |
|
|
|
 |
|
 |
|
Senior User
Join Date: Mar 2001
Location: Milan
Status:
Offline
|
|
Can you post your applescript somewhere?
If it isn’t too big then just post it in the forum.
|
|
Nothing to see, move along.
|
| |
|
|
|
 |
|
 |
|
Professional Poster
Join Date: Oct 2001
Location: London
Status:
Offline
|
|
I've written a quick and dirty applescript to control itunes on my server from my Powerbook (which uses airport). Now I've got a mobile remote for my music! yay. if you want a copy it's on my itools webpage.
as you will see it's not the best UI, but the script is so simple you can hack it to behave any way you want - feel free to improve it and re-post here.
Warning - you will have to compile this yourself in script editor and change any occurrence of myhost.domain.com to the name/ip address of the machine you want to control.
warning 2 - I have only tested this on os X 10.1 and itunes 2.0.1 - I have no idea how it behaves under 9.
warning 3 - you will have to enable "Allow remote apple events" in the Sharing panel of System Preferences of the target machine before compiling the script.
http://homepage.mac.com/diggorylaycock/
|
|
|
| |
|
|
|
 |
|
 |
|
Mac Elite
Join Date: Sep 2000
Location: New York
Status:
Offline
|
|
My scripts are a bit cleaner than yours, and each is a different file. I set them as hot keys using keyboard maestro. All you have to do is insert the IP of the machine that you want to control where it says IPADDRESS in the top of each script. You will also need remote apple events turned on in the sharing prefs. good luck.
The play script:
property remote_IP : "eppc://IPADDRESS"
property remote_iTunes : application "iTunes" of machine remote_IP
try
using terms from application "iTunes"
tell remote_iTunes
if player state is playing then
pause
else
if player state is paused then
play
else
if player state is stopped then
play
end if
end if
end if
end tell
end using terms from
end try
------
the previous script:
property remote_IP : "eppc://IPADDRESS"
property remote_iTunes : application "iTunes" of machine remote_IP
try
using terms from application "iTunes"
tell remote_iTunes
previous track
end tell
end using terms from
end try
--------
the next script:
property remote_IP : "eppc://IPADDRESS"
property remote_iTunes : application "iTunes" of machine remote_IP
try
using terms from application "iTunes"
tell remote_iTunes
next track
end tell
end using terms from
end try
|
|
|
| |
|
|
|
 |
|
 |
|
Posting Junkie
Join Date: Jun 2001
Location: Washington DC
Status:
Offline
|
|
Originally posted by waffffffle:
<STRONG>I now can lie on my back in bed using my new iBook while my Pismo sits on my desk churning out tunes via iTunes and my soundsticks, and I can control it ALL from the iBook!</STRONG>
Hey! You stole my setup! 
|
|
|
| |
|
|
|
 |
|
 |
|
Mac Elite
Join Date: Sep 2000
Location: New York
Status:
Offline
|
|
So who's using my scripts? Any thank yous? I guess not. . .
So is anyone here good enough with AppleScript to make a real remote app that can display the current song? I'm not that good with AppleScript but it would be really nice to have a small little window to control iTunes, maybe with a prefs pane so you could enter the IP of the remote machine or something. I think that would be very cool.
|
|
|
| |
|
|
|
 |
|
 |
|
Mac Elite
Join Date: Sep 2000
Location: New York
Status:
Offline
|
|
I'm getting a little better. This version of the play script now displays the current track in a dialog box, but you have to click OK to get rid of it. I don't know how to make windows with AppleScript. I have a feeling this will need to wait for AppleScript studio, unless someone has RealBasic.
property remote_IP : "IPADDRESS"
property remote_iTunes : application "iTunes" of machine remote_IP
try
using terms from application "iTunes"
tell remote_iTunes
if player state is playing then
pause
else
if player state is paused then
play
else
if player state is stopped then
play
end if
end if
end if
set current_song to name of current track
set current_song_artist to artist of current track
set current_song_album to album of current track
end tell
end using terms from
end try
display dialog current_song_artist & " : " & current_song & " : " & current_song_album buttons {"OK"} default button 1
|
|
|
| |
|
|
|
 |
|
 |
|
Mac Elite
Join Date: Sep 2000
Location: New York
Status:
Offline
|
|
Ok I've got more to share. I know have a script that will show the status of iTunes (playing/paused/stopped, current track, artist, album, and volume) a well as these 2 scripts to control the volume. This all works very good with keyboard maestro which lets you assign hot keys to anything.
property remote_IP : "eppc:/IPADDRESS"
property remote_iTunes : application "iTunes" of machine remote_IP
try
using terms from application "iTunes"
tell remote_iTunes
if player state is playing then
set player_state to "Playing"
else
if player state is paused then
set player_state to "Paused"
else
if player state is stopped then
set player_state to "Stopped"
end if
end if
end if
set current_song to name of current track
set current_song_artist to artist of current track
set current_song_album to album of current track
set sound_volume to sound volume
end tell
end using terms from
end try
display dialog "Status: " & (player_state as string) & "
Current Track: " & current_song_artist & " : " & current_song & " : " & current_song_album & "
Volume : " & sound_volume & "%" buttons {"OK"} default button 1
-----volume script down:
property remote_IP : "eppc:/IPADDRESS"
property remote_iTunes : application "iTunes" of machine remote_IP
try
using terms from application "iTunes"
tell remote_iTunes
set sound volume to (sound volume - 20)
end tell
end using terms from
end try
-----volume script up:
property remote_IP : "eppc:/IPADDRESS"
property remote_iTunes : application "iTunes" of machine remote_IP
try
using terms from application "iTunes"
tell remote_iTunes
set sound volume to (sound volume + 20)
end tell
end using terms from
end try
|
|
|
| |
|
|
|
 |
|
 |
|
Dedicated MacNNer
Join Date: Jan 2001
Location: Computer Error: Unknown
Status:
Offline
|
|
Does anyone know of good app for OS X to assign scripts to the function keys?
|
"...Because the people who are crazy enough to think they can change the world,
are the ones who do."
-To the Crazy Ones
|
| |
|
|
|
 |
|
 |
|
Mac Elite
Join Date: Sep 2000
Location: New York
Status:
Offline
|
|
Originally posted by graphiteman:
<STRONG>Does anyone know of good app for OS X to assign scripts to the function keys?</STRONG>
If you read 2 of my above quotes you'll see that I've already said that Keyboard Maestro is good for that purpose. Look for it on versiontracker.
|
|
|
| |
|
|
|
 |
|
 |
|
Mac Elite
Join Date: Oct 2000
Status:
Offline
|
|
waffffle, here is a slightly more cleaned up version of your code, I mostly merged the two properties and fixed up your if statements...
property remote_iTunes : application "iTunes" of machine "eppc:/IPADDRESS"
try
using terms from application "iTunes"
tell remote_iTunes
if player state is playing then
set player_state to "Playing"
else if player state is paused then
set player_state to "Paused"
else if player state is stopped then
set player_state to "Stopped"
end if
set thestring to "Status: " & player_state & return & ¬
¬
"Current Track: " & artist of current track & " : " & name of current track & " : " & album of current track & return & ¬
¬
"Volume : " & sound volume & "%"
tell me to display dialog thestring buttons {"OK"} default button 1
end tell
end using terms from
end try
A few suggestions...
1. make the script prompt the user for the IP when the run the application, but only when it is their first run.
2. If using OS 9 then give the app a gui. Using Dialog Director you can do some neat things. You can basically recreate iTunes. Playlists, play, stop, pause buttons etc.. If using OS 9 then I would even be willing to do it for you.
3. Drop the 'try' and 'using terms from' blocks.. I don't think they are needed at all.
Edit: Edited the script I use to turn the clipboard into UBB Code so that it turns tabs into hard spaces.
[ 11-14-2001: Message edited by: Synotic ]
|
|
|
| |
|
|
|
 |
|
 |
|
Mac Elite
Join Date: Sep 2000
Location: New York
Status:
Offline
|
|
Synotic, I'd be very interested in that script you have to turn styled text to UBB. Can it do colors?
|
|
|
| |
|
|
|
 |
|
 |
|
Mac Elite
Join Date: Oct 2000
Status:
Offline
|
|
Originally posted by waffffffle:
<STRONG>Synotic, I'd be very interested in that script you have to turn styled text to UBB. Can it do colors?</STRONG>
No, it can't do colors, I suppose I could make all the text withing the [B][/B] tags red, all strings green. and everything else blue, or whatever, but it would be *very* slow. I can't think of a less complicated way to get all the strings than stepping through each character for a " and then stepping through the next ones until I find another. This would mean it would screw up if you tried to put in AppleScript that hasn't be checked... and I dunno how to not make it colorize the comments... so not really worth it.
You'll need to download Clipboard To HTML... save the script below as an applet. Then if you want to use it, copy your script and run it and it will change the clipboard for you.
(btw, I dunno how well it will do converting this particular script.. lol)
on run
set theConvert to convert the clipboard to html
set the clipboard to (( my replaceSubstrings({"<B>", "</B>", "<I>", "</I>", "<P>", "&not;", "&amp;", tab, "[/B] [B]", "[/I] [I]", ":D", ":)", ":(", "&lt;", "&gt;", "&#171;", "&#187;"}, {"[B]", "[/B]", "[I]", "[/I]", "", "¬", "&", " ", " ", " ", ":[b][i][/b][/i]D", ":[b][i][/b][/i])", ":[b][i][/b][/i](", "<", ">", "«", "»"}, theConvert)) as string)
delay 0.4
beep
end run
on replaceSubstrings(searchString, replaceString, thestring)
repeat with i from 1 to length of searchString
set oldDelim to AppleScript's text item delimiters
set AppleScript's text item delimiters to (item i of searchString)
set tempList to text items of thestring
set AppleScript's text item delimiters to (item i of replaceString)
set thestring to tempList as string
set AppleScript's text item delimiters to oldDelim
end repeat
return thestring
end replaceSubstrings
I just realized that this is only for OS 9... :o
(If the script you are using has [B] or [I] tags then it screws up :-/ I had to use my UBB-> non executable ubb script so that it wouldn't convert parts of it)
[ 12-24-2001: Message edited by: Synotic ]
|
|
|
| |
|
|
|
 |
 |
|
 |
|
|
|
|
|

|
|
 |
Forum Rules
|
 |
 |
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is Off
|
|
|
|
|
|
 |
 |
 |
 |
|
 |
|