Forum Moderators: open
//if run from a html page, path must be full system path to the file, such as 'C:/myfolder/myfile.txt'
function getFileText(path, asArray) {
//scripting the FileSystemObject
//http://msdn.microsoft.com/en-us/library/d6dw7aeh(v=VS.85).aspx
var fso = new ActiveXObject('Scripting.FileSystemObject'),
tf = fso.OpenTextFile(path, 1), //the '1' means ForReading,
//2 would be ForWriting,
//8 would be ForAppending, consult: http://msdn.microsoft.com/en-us/library/czxefwt8(v=VS.85).aspx
s = tf.ReadAll();
return (asArray) ? s.split('\r\n') : s;
}
function getServers() {
var j,
oIE = new ActiveXObject("InternetExplorer.Application"),
basePath = 'http://dssapps.com/runbook/QDetail.asp?ServerName=',
//update serverNamesFilePath to the location of your server names text file on your computer:
serverNamesFilePath = 'C:/testing/IEopenMultiTabs/serverNames.txt',
serverNames = getFileText(serverNamesFilePath, true),
len = serverNames.length;
for (j = 0; j < len; j++) {
if (j > 0) {
oIE.Navigate2(basePath + serverNames[j], 4096); //4096 equivalent of navOpenInBackgroundTab or 0x1000
} else {
oIE.Navigate2(basePath + serverNames[j]);
}
}
oIE.Visible = true;
}
getServers();