loek17 Posted March 26, 2012 Share Posted March 26, 2012 helloi am trying to make a auto import script for itunesbut i am getting this errors---------------------------AutoIt Error---------------------------Line 114 (File "C:\Users\Koos\Documents\AutoIt\scripts\iTunes.au3"):$Library_Playlist.AddTrack($path)$Library_Playlist.AddTrack($path)^ ERRORError: The requested action with this object has failed.and later---------------------------AutoIt Error---------------------------Line 83 (File "C:\Users\Koos\Documents\AutoIt\scripts\iTunes.au3"):$Playlist_Handle.ItemByName($PlayList_Name).AddTrack($sng_nm)$Playlist_Handle.ItemByName($PlayList_Name).AddTrack($sng_nm)^ ERRORError: The requested action with this object has failed.i am using iTunes UDFmy code is#include <File.au3> #include <Array.au3> #include "iTunes.au3" $sPath="C:\Users\Public\Music\Sample Music" $input= " " $PlayListName="top 40" Local $FileList = _FileListToArray($sPath ,"*.mp3",0); get all mp3 files in the map If @error = 1 Then MsgBox(0, "", "No Folders Found.") Exit EndIf If @error = 4 Then MsgBox(0, "", "No Files Found.") Exit EndIf _iTunes_Start() ;For $i=1 To $FileList[0] ;$FileList [0] is the amount of mp3 files in the folder ;$path=$sPath&"\"&$FileList[$i] ;at the file name to the path ;_iTunes_Library_AddTrack($path) ; import the file to itunes ;Next For $i=1 to $FileList[0] ; remove te .mp3 extrention so the song name remains $RemoveText= '' $input = $FileList[$i] $Input = StringReplace ($Input, ".mp3", $RemoveText) ;Scans $Input for .mp3 and replaces it with $RemoveText Next For $i=1 to $FileList[0] MsgBox ('0', "test", $FileList[$i]) _iTunes_PlayList_Add($PlayListName, $FileList[$i]) ;at the songs i just importet to my playlist Next Exitcould it be that iTunes UDF to old is and no longer works(sorry for bad English)greetings Loek Link to comment Share on other sites More sharing options...
MrMitchell Posted March 27, 2012 Share Posted March 27, 2012 Just use _iTunes_Library_AddTrack() with a full path to a file by itself and see if you can get the function working at all... like this: _iTunes_Library_AddTrack("C:UsersPublicMusicSample MusicSampleSong.mp3") If that works then add a line after "$path = $sPath & "" & $FileList[$i]" to output the contents of $path before you try to use the _iTunes_Library_AddTrack() method on it: ConsoleWrite("$path = " & $path & @CRLF) or MsgBox(0, "$path", $path) Link to comment Share on other sites More sharing options...
loek17 Posted March 27, 2012 Author Share Posted March 27, 2012 putting the full path in the function didn't work although if i use msgbox and 1 cop the path and launch it it will work it think the iTunes udf is broken i am now going to try it by launching the path with shellexecute Link to comment Share on other sites More sharing options...
MrMitchell Posted March 27, 2012 Share Posted March 27, 2012 although if i use msgbox and 1 cop the path and launch it it will workWhat's that mean?it think the iTunes udf is brokenI just downloaded the COM documentation and it hasn't changed in two years. Though possible, it seems unlikely that Apple broken the underlying function that the UDF uses.i am now going to try it by launching the path with shellexecuteLaunching what exactly? You mean associate MP3 files with iTunes then launch the MP3 so that iTunes automatically imports it? Link to comment Share on other sites More sharing options...
loek17 Posted March 28, 2012 Author Share Posted March 28, 2012 i got it running now i needed to use _addfile instat of _addtrack Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now