Должно работать
var f=GetWayToFile();
if(f)
MakeText(f);
function GetWayToFile() {
var f = browseForFolder("");
if(f!=null && f.length>0)
return f[1];
else
return null;
}
function GetHeader()
{
var page = '<html>\n<header>\n<meta http-equiv="Content-Type" content="text/html; charset=utf-8">\n</header>\n';
}
function GetFiles(folderspec ) {
var fso = new ActiveXObject("Scripting.FileSystemObject");
var f = fso.GetFolder(folderspec);
var fc = new Enumerator(f.Files);
var s = new array(100);
var num = 0;
for (; !fc.atEnd(); fc.moveNext())
{
s[num] += fc.item();
num+=1;
};
return s;
}
function MakeText(f){
var PageText = '';
PageText+= GetHeader();
var BodyTextStart = '<body>\n';
var BodyDivText = '';
var ImgArr = GetFiles(f);
var BodyTextFinal = '</body>\n</html>';
var count = 0;
while (ImgArr[count]<>'')
{
BodyDivText = BodyDivText +'<div class = "photo"><img class = "img" src = "' + ImgArr[count]+ '" ></div>\n';
count++;
}
PageText=BodyTextStart+BodyDivText+BodyTextFinal;
WriteToFile(PageText);
return 0;
}
function WriteToFile(text)
{
var fso = new ActiveXObject('Scripting.FileSystemObject');
var s = fso.CreateTextFile("C:\\NewFile.html", true);
s.WriteLine(text);
s.WriteLine('***********************');
s.Close();
}