Setting Order of Updated Podcasts

Hello,

Just switched over from a PC to a Mac, so sorry if this question is very basic. Seems that my iPod plays the podcasts I listen to daily in order based on the “date added” criteria. Thus, part of a script that I’ve cobbled together downloads the first podcast I want to listen to, delays 10 or 15 seconds, then downloads the next one I want to listen to, etc:
updatePodcast (first track of playlist “Podcasts” whose album is “NPR: Hourly News Summary”)
delay 15
updatePodcast (first track of playlist “Podcasts” whose album is “AP NewsPulse”)
delay 10
updatePodcast (first track of playlist “Podcasts” whose album is “CNN News Update”)

My question is: Is there a way to replace the delay statements with coding that better ensures that the previous update action has been completed before the next begins?

Thanks for any help.

Hi,

I haven’t tested it in real life, but it could work with GUI scripting.
While downloading something an entry named “Downloads” appears on the left side


property PodcastList : {"NPR: Hourly News Summary", "AP NewsPulse", "CNN News Update"}

tell application "iTunes"
	activate
	tell window "iTunes" to set minimized to false
	repeat with i in PodcastList
		my update_Podcast(first track of playlist "Podcasts" whose album is i)
	end repeat
end tell

on update_Podcast(t)
	tell application "iTunes" to updatePodcast t
	repeat until check_Downloads_present()
		delay 0.5
	end repeat
	
	repeat while check_Downloads_present()
		delay 1
	end repeat
end update_Podcast

on check_Downloads_present()
	tell application "System Events"
		tell process "iTunes"
			tell rows of outline 1 of scroll area 1 of splitter group 1 of splitter group 1 of window 1
				return ((name of static text 1) as Unicode text) contains "Downloads"
			end tell
		end tell
	end tell
end check_Downloads_present

Thanks for your help, Stefan. Unfortunately when I try this I get the error message “System Events got an error: Can’t get splitter group 1 of splitter group 1 of window 1 of process “iTunes”. Invalid index.” and “Unicode text” is highlighted in the Script Editor window.

sorry there is only one splitter group

try this handler


.
on check_Downloads_present()
	tell application "System Events"
		tell process "iTunes"
			tell outline 1 of scroll area 1 of splitter group 1 of window 1
				return name of static text of rows contains "Downloads"
			end tell
		end tell
	end tell
end check_Downloads_present

Thanks! Will give that a try.