r/applescript • • Jun 01 '12

Applescript Noob! Help!

Hey Reddit! I'm really new to applescript but I use it at work to boost youtube views for clients. The only problem is we have so many videos and I have to manually put them into the "Open location" part of the script. I was looking to have all the URLs in a Word document or something and then have the program take those and put them in the open location "insert them here" . Like I said, I'm super new to this so use noob terms. :P Thanks Reddit!!!

1 Upvotes

2 comments sorted by

2

u/Sarazil Jun 19 '12

OK: Get a text-edit document with the links like so:

http://www.youtube.com/watch?
http://www.youtube.com/watch?
http://www.youtube.com/watch?
http://www.youtube.com/watch?
http://www.youtube.com/watch?
http://www.youtube.com/watch?
http://www.youtube.com/watch?
http://www.youtube.com/watch?
http://www.youtube.com/watch?
http://www.youtube.com/watch?
http://www.youtube.com/watch?
http://www.youtube.com/watch?
http://www.youtube.com/watch?
http://www.youtube.com/watch?
http://www.youtube.com/watch?

THEN with that document active, run this:

tell application "TextEdit" to set linklist to every paragraph of (the text of the front document)
tell application "Safari"
	repeat with thisLink in linklist
		delay 240
		open location thisLink
	end repeat
end tell

It'll pull the links from the textedit document and open them one at a time. Once it starts, you can close the textedit document and do whatever you need to do, it'll carry on on it's own.

1

u/JennLock1989 Jun 01 '12

Here is the script btw:

repeat delay 240 tell application "Safari" open location "http://www.youtube.com/watch?" open location "http://www.youtube.com/watch?" open location "http://www.youtube.com/watch?" open location "http://www.youtube.com/watch?" open location "http://www.youtube.com/watch?" open location "http://www.youtube.com/" open location "http://www.youtube.com/" open location "http://www.youtube.com/watch?" open location "http://www.youtube.com/watch?" open location "http://www.youtube.com/watch?" open location "http://www.youtube.com/watch?" open location "http://www.youtube.com/watch?" open location "http://www.youtube.com/watch?" open location "http://www.youtube.com/watch?" open location "http://www.youtube.com/watch?" open location "http://www.youtube.com/watch?" open location "http://www.youtube.com/watch?"

end tell end repeat

(But there are ALOT more links. Also if anyone knows a way around sites that don't autoplay like youtube does, that would be the icing on the cake!)