Applescript with Itunes not retaining track info after selection


i have put script process song information text file comma seperated values, , add them playlist. write values not locate text file. works well, implement additional functionality. have added ability select song when search results more one. however, doesn't matter select list. adds song @ beginning of selection regardless of chosen. appreciated.

code:
set myprefsfile (choose file prompt "select file read:") set notfound ((path desktop folder) string) & "notfound.txt" open access notfound write permission open access myprefsfile set applescript's text item delimiters {","} set prefscontents read myprefsfile using delimiter {","} close access myprefsfile set x 0 set theplaylist "temp" tell application "itunes" 	make new user playlist properties {name:"temp-1"} end tell repeat number of items in prefscontents times 	set x x + 1 	set track_name item x of prefscontents 	tell application "itunes" 		get view of front window 		tell library playlist 1 			set search_results (search track_name) 			copy search_results theplaylist 		end tell 		if search_results's length > 1 			set tracknames {} 			set trackartist {} 			repeat thistrack in search_results 				try 					set end of tracknames (artist of thistrack & " - " & name of thistrack string) 				on error 					set end of tracknames "<track name missing>" 				end try 			end repeat 			set myresult (choose list tracknames) 			repeat myresult in search_results 				duplicate myresult playlist "temp-1" 				if 1 = 1 exit repeat 			end repeat 		else 			repeat myresult in search_results 				duplicate myresult playlist "temp-1" 				if 1 = 1 exit repeat 			end repeat 		end if 	end tell 	if search_results = {} write track_name file notfound end repeat close access file notfound
 

here's problem:
code:
set myresult (choose list tracknames)  repeat myresult in search_results
do know why wrong?
 


Forums Macs Mac Programming


  • iPhone
  • Mac OS & System Software
  • iPad
  • Apple Watch
  • Notebooks
  • iTunes
  • Apple ID
  • iCloud
  • Desktop Computers
  • Apple Music
  • Professional Applications
  • iPod
  • iWork
  • Apple TV
  • iLife
  • Wireless

Comments

Popular posts from this blog

Has to be the funniest headline ive ever seen

Man Brings Goat to Apple Store and has Pizza Delivered

Elusive Ninja: The Shadowy Thief - Can you survive the fast-paced ninja chaos?