I’m new to the Applescript scene, but I find it really cool how it lets you do so many things. I’ve been reading a lot, and I’ve done a lot of experiments, and I’ve been trying my luck at a few personal projects. The first of these projects is to use a wireless mouse to remotely control iTunes. My goal is to make a script that when you left-click, iTunes will skip backward, right-click and iTunes will skip forward, and scroll to change the volume. I downloaded the iTunes scripts from Apple, but that’s as far as I’ve gotten. Could someone please point me in the right direction?
EDIT: So a friend suggested a few downloadable scripts, and now I know the commands to control the volume, and skip a track in iTunes, how do i go back a track? Is it:
tell application “iTunes”
previous track
end tell
I am still confused about how to integrate a mouse so that clicking a button or scrolling would activate a command… would someone help me with this?
Argh, come on, someone help me please! I’ve stayed up trying to finish this but I’m stuck!
I want to control iTunes with a wireless mouse. So I this is what I’ve got.
if <left click> then
tell application "iTunes"
previous track
end tell
end if
if <right click> then
tell application "iTunes"
next track
end tell
end if
if <scroll up> then
tell application "iTunes"
copy 150 to units
if the volume adjustment of the current track is less than 255 then
set the volume adjustment of the current track to the (volume adjustment of the current track) + units
end if
end tell
end if
if <scroll down> then
tell application "iTunes"
copy 50 to units
if the volume adjustment of the current track is greater than -255 then
set the volume adjustment of the current track to the (volume adjustment of the current track) - units end if
end tell
end if
Is that even close? I need to know what to put inside the <> marks. I’m totally clueless.
AppleScript itself can’t listen to the extra buttons on your mouse. You would need to have software that came with the mouse that allows you to choose what the buttons do. If the mouse software allows you to assign applications to a button, then you could make little mini-apps using AppleScript that do what you want.
Basically, AppleScript can control iTunes the way you want - the tricky part is getting software to listen to the mouse that passes the message on to AppleScript. One possibility would be somethign like Quicksilver (which does a LOT more). You could set a Trigger in Quicksilver that listens for certain mouse actions. It can have triggers that run a script based on mouse buttons (not scrolling, but extra buttons). That may cover what you want. Quicksilver is at http://www.blacktree.com/quicksilver
By the way, Quicksilver will give you a lot more than that. Check it out.