jkramlich
08-18-2003, 08:06 AM
ATI recently released the Macintosh drivers for their Remote Wonder RF remote control. It's very nice for controlling iTunes. You can program it's buttons to launch applications so I modified an AppleScript to launch iTunes, then play a random song from a specific playlist. I saved the applescript as an application, then mapped it to one of the keys on my Remote Wonder. the end result is that I can push a single button to start playing Classical music.
Perhaps others might find it useful. Change the value "xClassical" to whatever playlist you want.
Here's the script:
<------BEGIN SCRIPT---------->
property required_version : "2.0.3"
tell application "iTunes"
activate
-- VERSION CHECK
set this_version to the version as string
if this_version is not greater than or equal to the required_version then
beep
display dialog "This script requires iTunes version: " & required_version & ?
return & return & ?
"Current version of iTunes: " & this_version buttons {"Update", "Cancel"} default button 2 with icon 2
if the button returned of the result is "Update" then
my access_website("http://www.apple.com/itunes/download/")
return "incorrect version"
end if
end if
tell source "Library"
tell playlist "xClassical"
set this_track to some track
set this_name to the name of this_track
set this_artist to the artist of this_track
set this_album to the album of this_track
play this_track
end tell
end tell
--display dialog "Now playing?" & return & return & ?
-- "Name: " & this_name & return & ?
-- "Artist: " & this_artist & return & ?
-- "Album: " & this_album buttons {"?"} default button 1 giving up after 10
end tell
on access_website(this_URL)
ignoring application responses
tell application "Internet Explorer"
GetURL this_URL
end tell
end ignoring
end access_website
<------END SCRIPT---------->
Perhaps others might find it useful. Change the value "xClassical" to whatever playlist you want.
Here's the script:
<------BEGIN SCRIPT---------->
property required_version : "2.0.3"
tell application "iTunes"
activate
-- VERSION CHECK
set this_version to the version as string
if this_version is not greater than or equal to the required_version then
beep
display dialog "This script requires iTunes version: " & required_version & ?
return & return & ?
"Current version of iTunes: " & this_version buttons {"Update", "Cancel"} default button 2 with icon 2
if the button returned of the result is "Update" then
my access_website("http://www.apple.com/itunes/download/")
return "incorrect version"
end if
end if
tell source "Library"
tell playlist "xClassical"
set this_track to some track
set this_name to the name of this_track
set this_artist to the artist of this_track
set this_album to the album of this_track
play this_track
end tell
end tell
--display dialog "Now playing?" & return & return & ?
-- "Name: " & this_name & return & ?
-- "Artist: " & this_artist & return & ?
-- "Album: " & this_album buttons {"?"} default button 1 giving up after 10
end tell
on access_website(this_URL)
ignoring application responses
tell application "Internet Explorer"
GetURL this_URL
end tell
end ignoring
end access_website
<------END SCRIPT---------->