AutoHotkey Community

It is currently May 27th, 2012, 11:26 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: Sorting out iTunes
PostPosted: August 9th, 2009, 10:12 pm 
Offline

Joined: August 9th, 2009, 9:57 pm
Posts: 1
I was recently sorting out my filenames for music, and obviously iTunes therefore lost the "location" of each song. I was hoping to make an automated script that would right click on a song, click on "Get Info," then when the iTunes box comes up its says that it can't find "song name" would you like to locate, the script would copy the song name, then click on locate, this would get it into the windows browser thing, it stay in teh main foldr where music is so no redirection is needed, I just need it to paste the song name into the search box on the top right, then click on the first result that comes up. I know it's long, but I have like 2600 songs and I don't want to find all of them manually. Also it would have to somehow find out which songs needed to be located, in iTunes it has an exclamation mark next to the song but I don't know how to get AHK to find that.

I could get it to work with one song, kindof, but I wanted it to sort through all of iTunes, but I can't delete all the songs then re-put them in as that would mess up the playlists and play counts and stuff, which I don't want. I haven't made a script this complex before, and help would be much appreciated.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 9th, 2009, 11:33 pm 
...delete itune list, and add list from folder again


Report this post
Top
  
Reply with quote  
 Post subject: Remove dead tracks
PostPosted: November 9th, 2009, 10:26 pm 
Offline

Joined: June 17th, 2008, 9:03 pm
Posts: 19
Location: Kiel, Germany
The following script does something similar and could perhaps be adapted to your own requirements.

Code:
; a translation to ahk of an js-example in the iTunes SDK documentation
#SingleInstance, Force
ScriptName = RemoveDeadTracks
lng_DeleteDeadTrack = Delete this track from library?
lng_DeletedTracks = Deleted
lng_PleaseWait = Please wait
lng_SearchDeadTracks = Searching for tracks that lack the original file.
lng_RemoveDeadTracks = Remove not available (dead) tracks
lng_CheckedTracks = Checked

#Include, com.ahk ; by Sean: http://www.autohotkey.com/forum/topic22923.html
COM_Init()
iTunesApp := COM_CreateObject("iTunes.Application")  ;Create the object

deadTracks = 0
deletedTracks = 0
numTracks := COM_Invoke(iTunesApp, "LibraryPlaylist.Tracks.Count")
totalTracks := numTracks
While (numTracks != 0)
{
checkedTracks := A_Index
Progress, C0 zh0 fs10, %lng_SearchDeadTracks%`n%lng_PleaseWait%... (%numTracks%),, %ScriptName% %lng_4iTunes% %ScriptVersion%, MS Sans Serif
Sleep, 1
tempVar = LibraryPlaylist.Tracks.Item(%numTracks%).Kind
If COM_Invoke(iTunesApp, tempVar) = 1 ; (1) Library playlist
  {
  tempVar = LibraryPlaylist.Tracks.Item(%numTracks%).Location
  If COM_Invoke(iTunesApp, tempVar) = ""
    {
    Progress, Hide
    deadTracks ++
    tempVar1 = LibraryPlaylist.Tracks.Item(%numTracks%).Artist
    tempVar1 := COM_Invoke(iTunesApp, tempVar1)
    tempVar2 = LibraryPlaylist.Tracks.Item(%numTracks%).Name
    tempVar2 := COM_Invoke(iTunesApp, tempVar2)
    MsgBox, 262179, %ScriptName% %lng_4iTunes% %ScriptVersion%, %tempVar1% - %tempVar2%`n`n%lng_DeleteDeadTrack%
    Progress, Show
    IfMsgBox, Yes
      {
      tempVar = LibraryPlaylist.Tracks.Item(%numTracks%).Delete
      COM_Invoke(iTunesApp, tempVar)
      deletedTracks ++
      }
    IfMsgBox, Cancel
      Break
    }
  }
numTracks --
}
Progress, Off
MsgBox, 262208, %ScriptName%, %lng_RemoveDeadTracks%`n`n%lng_CheckedTracks%:`t`t%checkedTracks%/%totalTracks%`n%lng_DeletedTracks%:`t`t%deletedTracks%/%deadTracks%

COM_Release(iTunesApp)
COM_Term()
ExitApp


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: Bing [Bot] and 19 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group