AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

iTunes Anywhere (keyboard shortcuts)
Goto page Previous  1, 2, 3
 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions
View previous topic :: View next topic  
Author Message
rockNme2349



Joined: 31 Aug 2007
Posts: 3

PostPosted: Fri Aug 31, 2007 9:41 pm    Post subject: Reply with quote

For anyone developing with iTunes in windows, i would definately look into iTunes COM Interface.

I used that to develop an itunes remote that allows me to remotely control itunes from any web broweser, even my phone, and gives me more controls such as typing in song names and playing them, and almost anything, even if there is no hotkey.
_________________
There are 10 types of people. Those that understand binary and those that don't.
Back to top
View user's profile Send private message
benbenben
Guest





PostPosted: Thu Nov 08, 2007 1:02 am    Post subject: mad props Reply with quote

thanks for the scripts here, i used the first one and just mapped them to the media keys, since those only worked when itunes was the active window....

SWEET!!!

I'm very pleased.
Back to top
ellipticaltable
Guest





PostPosted: Fri Dec 14, 2007 6:31 pm    Post subject: Reply with quote

If you want to be a bit fancier in talking to iTunes, you can do the following. It uses the iTunes SDK and ws4ahk (http://www.autohotkey.net/~easycom/). Basically, you get the full SDK functionality directly in your script.

This code doesn't do anything particularly useful at the moment. Instead, it shows how to do various things.

Code:

#Include ws4ahk.ahk

; Necessary initialization
WS_Initialize("JScript")
itunes := WS_CreateObject("iTunes.Application")
WS_AddObject(itunes, "itunesapp")
WS_ReleaseObject(itunes)

;Advance to the next track
WS_Exec("itunesapp.NextTrack ()")

;Display the current track and playlist
WS_Eval(trackname, "itunesapp.CurrentTrack.Name;")
WS_Eval(playlistname, "itunesapp.CurrentPlaylist.Name ;")
ToolTip, %trackname% in playlist %playlistname%
Sleep, 5000

; Required cleanup
WS_Uninitialize()



Hope this helps.
Back to top
darkpaladin79



Joined: 25 Nov 2007
Posts: 3

PostPosted: Tue Mar 11, 2008 12:09 am    Post subject: Reply with quote

Well, I've been using this script happily for almost a year now (I think, don't really know), but every now and then it stops working. I think it has something to do with things inside iTunes being selected, because it works after I bring it up and down again. But, I took the examples from ellipticaltable and rewrote the whole thing with the COM and ws4ahk. You need that ws4ahk.ahk file that he specifies, and right now I have the keys set to my mouse. So change those and you should be good to go! No more random desyncs for me.

Code:

#Include ws4ahk.ahk
#InstallMouseHook ;helps with mouse stuff being detected, you can leave it out if you want, seems to help me
OnExit, ExitSub

; Necessary initialization
WS_Initialize("JScript")
itunes := WS_CreateObject("iTunes.Application")
WS_AddObject(itunes, "itunesapp")
WS_ReleaseObject(itunes)

F18 & rbutton::
   WS_Exec("itunesapp.NextTrack ()")
return

F18 & lbutton::
   WS_Exec("itunesapp.PreviousTrack ()")
return

F18 & wheeldown::
   WS_Exec("itunesapp.SoundVolume = itunesapp.SoundVolume - 2")
return

F18 & wheelup::
   WS_Exec("itunesapp.SoundVolume = itunesapp.SoundVolume + 2")
return

F18::
   WS_Exec("itunesapp.PlayPause()")
return

ExitSub:
{
   ;MsgBox, Uninitializing
   WS_Uninitialize()
   ExitApp
}
Back to top
View user's profile Send private message
mashenden



Joined: 13 Mar 2008
Posts: 6

PostPosted: Tue Apr 01, 2008 1:33 am    Post subject: In need of help on similar effort Reply with quote

I need a AHK script using the iTunes COM. I have it in VBS and AutoIT, but am not real sure on how to convert either of them to AHK.

Here is what I have so far with your help:
Code:
WS_Initialize("JScript")
itunes := WS_CreateObject("iTunes.Application")
WS_AddObject(itunes, "itunesapp")
WS_ReleaseObject(itunes)
;?
;?
WS_Exec("itunesapp.PlayFirstTrack()")  ; Guessing on this one

ExitSub:
{
   ;MsgBox, Uninitializing
   WS_Uninitialize()
   ExitApp
}


This is the VBS code that works:
Code:
Set objApp = CreateObject("iTunes.Application")
Set colSources = objApp.Sources
Set objSource = colSources.ItemByName("Library")
Set colPlaylists = objSource.Playlists
Set objPlaylist = colPlaylists.ItemByName("Party Shuffle")
objPlaylist.PlayFirstTrack


This is the AutoIT code that works:
Code:
$objApp = ObjCreate("iTunes.Application")
$colSources = $objApp.Sources
$objSource = $colSources.ItemByName("Library")
$colPlaylists = $objSource.Playlists
$objPlaylist = $colPlaylists.ItemByName("Party Shuffle")
$objPlaylist.PlayFirstTrack()


Thank you in advance for any help.

Matt A
Back to top
View user's profile Send private message
erictheturtle



Joined: 27 Jun 2007
Posts: 58
Location: California

PostPosted: Fri Apr 11, 2008 5:08 pm    Post subject: Re: In need of help on similar effort Reply with quote

Hope this code isn't too late for you mashenden. It's untested, but this is basically how it could work.

Code:
; Setup a VBScript environment
WS_Initialize("VBScript")

; Get the iTunes app and library
vbcode_init =
(
   Set objApp = CreateObject("iTunes.Application")
   Set colSources = objApp.Sources
   Set objSource = colSources.ItemByName("Library")
   Set colPlaylists = objSource.Playlists
)
WS_Exec(vbcode_init)


; Handy function to get a playlist
GetPlaylist(playlist)
{
   WS_Exec("Set objPlaylist = colPlaylists.ItemByName(" ScriptStr(playlist) ")")
}
GetPlaylist("Party Shuffle")

; Start playing
WS_Exec("objPlaylist.PlayFirstTrack")




; Cleanup on exit
ExitSub:
{
   WS_Uninitialize()
   ExitApp
}

_________________
-m35
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions All times are GMT
Goto page Previous  1, 2, 3
Page 3 of 3

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group