Short version: I have a html file full of links. I want Safari to open the links of that page in a separate tab each.
Is there a way to script Safari or any app that will let me do this automatically?
Long version: You get emails from macnn when new posts arrive in threads you've subscribed to. Now, when you've been away for a while there can be very many of those emails waiting. What do you do? Select all of them, open them, click on the link to let Safari open it, switch back to Mail.app, delete that email, click on the link of the next email, etc. No way! Much too much hassle.
So, I wanted to do it automatically. I wrote a little shell script that gets the URLs out of the macnn emails, puts them in a file, adds html tags to the URLs, opens Safari and displays the list of links.
Code:
grep 'newpost' /Users/simon/Library/Mail/pop/INBOX.mbox/mbox > /tmp/new.txt
awk '{print "<a href=\"" $1 "\">" $1 "</a><br>"}' /tmp/new.txt > /tmp/new.html
open -a /Applications/Safari.app /tmp/new.html
sleep 2
rm /tmp/new.txt
rm /tmp/new.html
Now I can ctrl-click all of these links in Safari to get them to open in new tabs each, but that's still too much work.
But if I could pipe that file to an AppleScript I could have the script open up each URL in a new tab.
Any ideas how to do that?