Jump to content

Itunes Com Help


Recommended Posts

$iTunesApp = ObjCreate("iTunes.Application")
For $track in $iTunesApp.SelectedTracks
    If $track.Location = 0 Then
        $track.Delete;error here
    EndIf
Next

This script is supposed to simply delete tracks without locations.

It is only giving me the problem at the "$track.delete" command.

The documentation says I can do this though.

Please help

Thanks

Edited by CyberZeroCool

[center]AutoIT + Finger Print Reader/Scanner = COOL STUFF -> Check Out Topic![/center][center][font=Arial Black]Check out ConsultingJoe.com[/font][/center][center]My Scripts~~~~~~~~~~~~~~Web Protocol Managing - Simple WiFi Scanner - AutoTunes - Remote PC Control V2 - Audio SpectrascopePie Chart UDF - At&t's TTS - Custom Progress Bar - Windows Media Player Embed[/center]

Link to comment
Share on other sites

I've tried this but it removed all the tracks, because of the "IF"

$iTunesApp = ObjCreate("iTunes.Application")
$iLibrary = $iTunesApp.LibraryPlaylist
$allTracks = $iLibrary.Tracks
$count = 0
$removed = 0
$total = $allTracks.count
ProgressOn( "ITunes Clean Up", "Cleaning..." )
For $track in $allTracks
    $count = $count + 1
    ProgressSet( ($count/$total)*100, $track.Location )
    If $track.Location = 0 Then
        ProgressSet( ($count/$total)*100, "", $removed & " Tracks Removed" )
        $track.Delete
        $removed = $removed + 1
    EndIf
Next
ProgressSet( 100, "Complete" )
Sleep(1000)
Edited by CyberZeroCool

[center]AutoIT + Finger Print Reader/Scanner = COOL STUFF -> Check Out Topic![/center][center][font=Arial Black]Check out ConsultingJoe.com[/font][/center][center]My Scripts~~~~~~~~~~~~~~Web Protocol Managing - Simple WiFi Scanner - AutoTunes - Remote PC Control V2 - Audio SpectrascopePie Chart UDF - At&t's TTS - Custom Progress Bar - Windows Media Player Embed[/center]

Link to comment
Share on other sites

Any help?

[center]AutoIT + Finger Print Reader/Scanner = COOL STUFF -> Check Out Topic![/center][center][font=Arial Black]Check out ConsultingJoe.com[/font][/center][center]My Scripts~~~~~~~~~~~~~~Web Protocol Managing - Simple WiFi Scanner - AutoTunes - Remote PC Control V2 - Audio SpectrascopePie Chart UDF - At&t's TTS - Custom Progress Bar - Windows Media Player Embed[/center]

Link to comment
Share on other sites

  • Moderators

Here's something I threw together real quick.

#include <IE.au3>
_IEErrorHandlerRegister()

$oiTunes = ObjCreate("iTunes.Application")
$oMainLibrary = $oiTunes.LibraryPlaylist
$oTracks = $oMainLibrary.Tracks

$iDeletedTracks = _iTunesRemoveDeletedTracks($oTracks)
If $iDeletedTracks Then
    If $iDeletedTracks == 1 Then
        MsgBox(0, "Cleanup", "Removed 1 dead track.")
    Else
        MsgBox(0, "Cleanup", "Removed " & $iDeletedTracks & " dead tracks.")
    EndIf
Else
    MsgBox(0, "Cleanup", "No dead tracks were found.")
EndIf

Func _iTunesRemoveDeletedTracks($o_Tracks, $f_Log = 1)
    ; The ITTrackKindFile value will be use to check if a track is a physical file
    Local $ITTrackKindFile = 1, $iDeletedTracks = 0

    If $f_Log Then $Log = FileOpen(@ScriptDir & "\DeletedTracks.txt", 1)

    For $oTrack In $o_Tracks
        If $oTrack.Kind <> $ITTrackKindFile Then ContinueLoop
        If $oTrack.Location <> "" Then ContinueLoop
        If $f_Log Then
            $sArtist = $oTrack.Artist
            $sSong = $oTrack.Name
            FileWriteLine($Log, $sArtist & " - " & $sSong)
        EndIf
        $oTrack.Delete ()
        $iDeletedTracks += 1
    Next
    Return $iDeletedTracks
EndFunc   ;==>_iTunesRemoveDeletedTracks
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...