POV-Ray : Newsgroups : povray.off-topic : Context switching : Re: Context switching Server Time
4 Sep 2024 19:18:45 EDT (-0400)
  Re: Context switching  
From: Nicolas Alvarez
Date: 23 Apr 2010 17:18:08
Message: <4bd20e90@news.povray.org>
Invisible wrote:
> scott wrote:
>> Obviously it's just a simple example so you can see how it works.
> 
> Wikipedia seems to indicate that WSH supports JavaScript. I wonder if I
> can get that to work...

var fso = new ActiveXObject("Scripting.FileSystemObject");
var sFolder = "C:\\tmp";

var newFile = fso.CreateTextFile(sFolder+"\\FileList.txt", true);
var folder = fso.GetFolder(sFolder);
var files = folder.Files;

// yes, enumerating COM collections really is this messy in Javascript
var filesEnum = new Enumerator(files);
for (; !filesEnum.atEnd(); filesEnum.moveNext()) {
  var file = filesEnum.item();
  newFile.WriteLine(file.Name);
}

newFile.Close();
WScript.Echo("Done!");


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.