Jump to content

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

iTunes control with no gui


  • Please log in to reply
No replies to this topic
Veovis
  • Members
  • 389 posts
  • Last active: Mar 17 2009 12:24 AM
  • Joined: 13 Feb 2006
iTunes control based loosely on Rajat's Play any song from anywhere

/*
  ---------------------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 the hotkey to have the computer listen for one of the following:
 - space        Play/pause current song.
 - p            Play previous song.
 - n            Play next song.
 - shift p      Play previous album.
 - shift n      Play next album.

 - #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.
*/

#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."