Creating Files with TextStream...Help!

Results 1 to 2 of 2

Thread: Creating Files with TextStream...Help!

  1. #1
    Join Date
    Dec 1969

    Default Creating Files with TextStream...Help!

    Recently i have created a random insult generator, which has over 50 to the 7th power responses using javascript. (If you would like to see it go to For a new project i would like to use it to write 500 random insults to 500 different text files. The page i have created runs without error, but no text files are created or changed. I would also like to know how to incorporate a variable into a filepath using javascript. Here is my code so far:<BR><BR>&#060;body&#062;<BR>&#060;script language="JavaScript"&#062;<BR>&#060;!--<BR>var i<BR>for(i=1; i&#060;500; i++){<BR><BR> Const fsoForWriting = 2<BR><BR> Dim objFSO<BR> Set objFSO = Server.CreateObject("Scripting.FileSystemObject")< BR><BR><BR> Dim objTextStream<BR> Set objTextStream = objFSO.OpenTextFile(C:insults est.txt, fsoForWriting, True)<BR><BR><BR> objTextStream.WriteLine insult()<BR><BR><BR> objTextStream.Close<BR> Set objTextStream = Nothing<BR> Set objFSO = Nothing<BR> }<BR><BR>//--&#062;<BR>&#060;/script&#062;<BR><BR>&#060;/body&#062;<BR>&#060;/html&#062;<BR><BR>I have not included the head as it contains a rather lengthy insult generating function and I am confident it is not erroneus. I would appreciate all the help you could give me.

  2. #2
    Join Date
    Dec 1969

    Default I think you have bigger troubles...

    I&#039;m afraid I simply do not believe your statement that "the page i have created runs without error..."<BR><BR>You are BADLY mixing VBScript and JavaScript language syntax!<BR><BR>JavaScript (or JScript, whatever) doesn&#039;t allow the "SET" keyword.<BR>Or the CONST keyword.<BR>Or the DIM keyword.<BR>Or invoking methods/functions without parentheses.<BR>Or the keyword True (though it does have the keyword true...not True...JS is case sensitive).<BR><BR>In short, there is no way in the world that the code you show "runs without error" since it will not run at all.<BR><BR>Why do I get the feeling that you got your insult generator from somebody else? I just looked at the code, and it pointlessly calls the clock routine every second. Apparently, it was code designed for some other purpose that was "lifted" (partly incorrectly) for that page, yes? <BR><BR>Just out of curiosity, once you get these 500 files, what will you/can you possibly do with them?<BR><BR>And as for your statement "...a rather lengthy insult generating function and I am confident it is not erroneus..."<BR><BR>Really? Here&#039;s one that I got:<BR><BR>*** QUOTE ***<BR>You perform the 100m butterfly in sewage ponds, you horse fornicating, saliva-sniffing, elephant-undefinedspontaneous discharge of a pox-ridden fishwife.<BR>*** END QUOTE ***<BR><BR>Somehow, I feel that the word "undefined" in there (missing a space after it, incidentally) is indicative of an error in the function. No?<BR><BR><BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts