Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

iTunes Anywhere (keyboard shortcuts)


  • Please log in to reply
81 replies to this topic
polyphenol
  • Members
  • 1 posts
  • Last active: Oct 07 2005 02:06 PM
  • Joined: 07 Oct 2005
Just a little script for controlling iTunes from any window using keyboard shortcuts. Feel free to change them to your liking, of course. Changed it to use winkey[#]. You could change it to ctrl[^] or ctrl-alt[^!] or ctrl-shift[^+],etc. . Man, I love AutoHotkey.

Let me know of any problems or ideas. I am just getting aquainted with an app called 'Winspector Spy', mentioned somewhere in these here forums.


Hotkey List
--------------------------

winkey + \ = launch iTunes or hide/show
winkey + . = next song
winkey + , = previous song
winkey + / = play/pause toggle
winkey + ; = volume up
winkey + ' = volume down
winkey + = = preview song every 10 sec
winkey + - = stop preview mode

--------------------------

Peace, Dave


; iTunes Anywhere
; AutoHotkey Version: 1.x
; Language:       English
; Platform:       Win9x/NT
; Author:        Polyphenol <myemail@nowhere.com>
;
; Script Function:
;   Control iTunes from anywhere with hotkeys
;

#NoTrayIcon
#SingleInstance force
DetectHiddenWindows, on

#\::
IfWinNotExist, ahk_class iTunes
{
Run %ProgramFiles%\iTunes\iTunes.exe  ;launch program
return
}

IfWinExist, ahk_class iTunes ; toggle minimize/restore
{
IfWinNotActive ; restores window
WinActivate
Else
WinMinimize ; minimizes windows
return
}

#.::
IfWinExist, ahk_class iTunes
ControlSend, ahk_parent, ^{RIGHT}  ; > next
return

#,::
IfWinExist, ahk_class iTunes
ControlSend, ahk_parent, ^{LEFT}  ; < previous
return

#/::
IfWinExist, ahk_class iTunes
ControlSend, ahk_parent, {SPACE}  ; play/pause toggle
return

#;::
IfWinExist, ahk_class iTunes
ControlSend, ahk_parent, ^{UP}  ; vol up
return

#'::
IfWinExist, ahk_class iTunes
ControlSend, ahk_parent, ^{DOWN}  ; vol down
return

#=::
SetTimer, songpreview, 10000 ; change song every 10 sec
songpreview:
IfWinExist, ahk_class iTunes
ControlSend, ahk_parent, ^{RIGHT}
return

#-::
SetTimer, songpreview, Off
return

;endofscript


gbo
  • Members
  • 2 posts
  • Last active: Jan 12 2006 10:10 PM
  • Joined: 27 Jul 2005
Thank you, I was looking for that and you've done it 8)
_________________
Best Regards

Gil

Use what talents you possess;
the woods would be very silent if no
birds sang except those that sang best.

Szara
  • Guests
  • Last active:
  • Joined: --
I quit using iTunes in Windows solely because I couldn't figure out how to do this. Thank you much!

johnnysoko
  • Members
  • 2 posts
  • Last active: Jul 22 2006 04:42 AM
  • Joined: 22 Jul 2006
I'm wanting to use AutoHotkey to create a small device that I can use to remotely control itunes. One of the features I really want is to be able to rate songs while I'm 20 ft from the computer. Is there a way to include 'rate current song' and choose between 1 and 5 stars usings hotkeys?

Thanks.

Sivoev
  • Guests
  • Last active:
  • Joined: --
umm not very likely. unless there already is a hotkey for it (and there isnt as far as i know) it would be difficult at best, involving some kind of advanded control mouse click (if possible)

johnnysoko
  • Members
  • 2 posts
  • Last active: Jul 22 2006 04:42 AM
  • Joined: 22 Jul 2006
If anyone else is looking for a way to rate songs using hotkeys, I found this free program for windows...

http://www.mattberub...are/ituneskeys/

Niiklas
  • Guests
  • Last active:
  • Joined: --
These commands doesn't work when I minimize iTunes to the traybar. Do you think you can fix that?

Ivan
  • Guests
  • Last active:
  • Joined: --
Foobar2000 supports global key shortcuts in case anyone would like to switch to a media player that doesn't suck (on Windows, at least)

sun818
  • Guests
  • Last active:
  • Joined: --
Try iTunesKeys - It will let you rate songs. http://www.mattberub...are/ituneskeys/

Rob H
  • Guests
  • Last active:
  • Joined: --
Ok ,so this works great for me, but I'm wondering if its possible to send the imput to a different computer on a network using global hotkeys and how hard that would be to do.

Also if thats too hard I have an alternative, I run a program that simulates multiple monitors, maybe i could make a script that would in effect move the cursor to the left say 1500 pixles or whatever, sends an imput, then goes back to the original position. Then on the client computer i would have the above script.

if anyone feels ambitious or just wants to help or give advice you can email me at:
Rob[*dot*]Hyman[*at*]gmail[*dot*]com

Veovis
  • Members
  • 389 posts
  • Last active: Mar 17 2009 12:24 AM
  • Joined: 13 Feb 2006
Here is my script for controlling iTunes:

Infortunately, it does not work when iTunes is minimized or chilling in the tray, but if you just have it hiding behing whatever your working on, it works fine. Enjoy!

/*
  ---------------------iTunes Helper----------------------------
  ------------------------by Veovis-----------------------------

Control iTunes from any program, even full screen ones.  Use the
Song Selector to choose what song to play, and the commands to 
play,pause,skip songs, or change volume.

.-= Song Selector =-.
  Hotkey: Ctrl /

 Press the hotkey, type something, then press enter (or wait for
 the 5 second timeout) and iTunes will perform a search and play 
 all songs that have your critia in the name, artist, album, etc.
 So typing aquabats will play all songs by the aquabats, and 
 "aqua charge" would play all songs by aquabats in album charge.
 
.-= Commands =-.
  Hotkey: Ctrl . (period)

 Press ctrl . to have the computer listen for one of the following:
 - space        Play/pause current song.
 - p            Start song over (type 2p to play previous song)
 - n            Play next song.
 - shift p      Play previous album.
 - shift n      Play next album.

(in the following # means NUMBERS not WINKEY)
 - #p/#n/#P/#N  Go forward/back # songs/albums
     If you type a number, then p,n,P or N then iTunes will go
     forward/back that many songs/albums, for ex: 6n would go 
     forward six songs and 2P will go back 2 albums

 - # enter      If you type a number between 0 and 100 and press
                enter it will set the iTunes volume to the nearest
                5%.  So pressing 37enter will set it to 35.
 - escape       Cancel

For Example:
Pressing:         Does:
{ctrl}/aquabats   Plays all songs that match "aquabats" (using iTunes search)
{ctrl}.{space}    Play/pause
{ctrl}.p          Previous song
{ctrl}.n          next song
{ctrl}.{shift}p   Previous album
{ctrl}.{shift}n   Next Album
{ctrl}.4p         go back 4 songs
{ctrl}.5{shift}n  go forward 5 albums
{ctrl}.50         Set volume to 50%


*/

#singleinstance force
#NoEnv
SendMode Input
SetFormat,float,0.0
SetKeyDelay 25
StringCaseSense, On

^/::
   Input, UserInput, T5,{enter}{escape}
   ifequal,userinput,, return                ;if no input, dont continue
   ifequal,errorlevel,EndKey:Escape,return   ;if you press escape dont do anything
   controlsend,edit1,{esc},iTunes   ;this fixes a bug if your last search returned nothing
   loop, 2  ;dont know why this is necesary, just dont remove it
   {
      controlsettext,edit1,%userinput%,iTunes
      controlsend,,{enter}{tab}{down}{enter},iTunes
   }
return

^.::
   Input,command,C t3 *,{enter}, ,p,n,P,N
   if errorlevel = Match
   {
      stringright,key,command,1
      stringtrimright,count,command,1
      if key = %A_space%
         controlsend,ahk_parent,{space},iTunes
      if key = p
         controlsend,ahk_parent,{left %count%},iTunes
      if key = n
         controlsend,ahk_parent,{right %count%},iTunes
      if key = P                      ;previous album
         controlsend,ahk_parent,+^!{left %count%}{alt up}{control up}{shift up},iTunes
      if key = N                      ;next album
         controlsend,ahk_parent,+^!{right %count%}{alt up}{control up}{shift up},iTunes
   }
   
   if command = 0
      controlsend,ahk_parent,^+{down}{shift up}{ctrl up},iTunes
   else if command = 100
      controlsend,ahk_parent,^+{up}{shift up}{ctrl up},iTunes
   else if (command > 0) and (command <= 50)
   {
      steps := round(command*2,-1)/10
      volume := steps*5
      controlsend,ahk_parent,^+{down}{shift up}{ctrl up},iTunes
      controlsend,ahk_parent,^{up %steps%}{ctrl up},iTunes
   }
   else if (command > 50) and (command < 100)
   {
      steps := round((100 - command)*2,-1)/10
      volume := 100 - steps*5
      controlsend,ahk_parent,^+{up}{shift up}{ctrl up},iTunes
      controlsend,ahk_parent,^{down %steps%}{ctrl up},iTunes
   }
return

Posted Image
"Power can be given overnight, but responsibility must be taught. Long years go into its making."

cooza
  • Guests
  • Last active:
  • Joined: --
i bet you could get it to work when minimized or in tray by using part of the previous script.

brandon_r87
  • Guests
  • Last active:
  • Joined: --
Hi,

I'm making a simple GlovePie script so I can control iTunes with my Wii remote, mind if I include this script or link here so people can see what they need for the global shortcuts?

Veovis
  • Members
  • 389 posts
  • Last active: Mar 17 2009 12:24 AM
  • Joined: 13 Feb 2006
of course! go ahead! the whole point of autohotkey is that its open source, and everyone helps each other out. If we wanted to not share our source, we could compile it, but here everyone helps each other out! Just make sure to say where you got your code from.
Posted Image
"Power can be given overnight, but responsibility must be taught. Long years go into its making."

jonny
  • Members
  • 2951 posts
  • Last active: Feb 24 2008 04:22 AM
  • Joined: 13 Nov 2004
Just a small note, AutoHotkey itself is open-source, but it's at the scripter's discretion as to whether their creation will also be open-source. You could even distribute a commercial application written in AutoHotkey.