on insert_feed(feed) tell application "System Events" tell process "Doughnut" (* open subscription sheet and add feed *) click menu item "Subscribe to Podcast" of menu "File" of menu bar 1 set value of text field 1 of sheet 1 of window 1 to feed click button 3 of sheet 1 of window 1 delay 3 click button 1 of sheet 1 of window 1 end tell end tell end insert_feed on run {input, parameters} (* select OPML file *) set opml to POSIX path of (choose file with prompt "Select OPML file") (* open app *) tell application "Doughnut" activate end tell (* open menu and add URL *) tell application "System Events" tell XML file opml tell XML element "opml" tell XML element "body" set feeds to every XML element whose name = "outline" repeat with i from 1 to length of feeds set feed to item i of feeds tell feed set rss to value of XML attribute "xmlUrl" as string my insert_feed(rss) end tell end repeat end tell end tell end tell end tell return input end run