Advertisement

Get Chrome to open pages from a list in .txt

Started by April 22, 2010 05:39 AM
2 comments, last by dwarfsoft 14 years, 6 months ago
Hi guys. I was just curious, is it possible for you to save a bunch of url's in a text file and then get Chrome to somehow read that file, and open the pages based on the links in a new tab per link?
If you're using Windows, you can easily achieve this using WSH. Save the following into a file somewhere with a .js extension then drag and drop the text file onto it.

if (WScript.Arguments.length != 1) {	WScript.Echo('No file specified.');	WScript.Quit(1);}var wsh = WScript.CreateObject('WScript.Shell');var fso = WScript.CreateObject('Scripting.FileSystemObject');var file = fso.OpenTextFile(WScript.Arguments(0));while(!file.AtEndOfStream) {	var url = file.ReadLine();	if (url) wsh.Run(url);}file.Close();

It'll open the links in whatever your default browser is.

[Website] [+++ Divide By Cucumber Error. Please Reinstall Universe And Reboot +++]

Advertisement
Cool. Didn't even know this WSH existed!!
Will find out more about it.
Alternatively, most browsers allow you to pass more than one url on the command line.

You could do this the same way benryves suggested except by creating a single line like:

chrome "url1" "url2" "url3"

or you could use batch to do exactly what benryves suggsted too:

FOR /F "tokens=*" %%A IN ('myurls.txt') DO (  START Chrome %%A  )

This topic is closed to new replies.

Advertisement