From: Rob Christiansen on
this snippet first checks if the file exists. if it does, it does
nothing. if it doesn't exist, it creates it. but my code makes my script
crash. please, what am i doing wrong?
-------------------------------
var filename = filemonth +"-"+ fileday +"-20"+ fileyear +".txt";

var abs_path = String(Request.ServerVariables("PATH_TRANSLATED"));
//var FileToWorkWith = abs_path.replace(/\\\w*\.asp/,"\\")+ filename;
//<- ???
fso = new ActiveXObject("Scripting.FileSystemObject");

if( !fso.FileExists( filename ) ) //cccccccccccccccc
{ //aaa
fso = Server.CreateObject("Scripting.FileSystemObject")
f=fso.CreateTextFile( filename )
f.Close
} //aaa
else
{
Response.Write( filename +" already exists but will append your new
submission. <br>" );
fso.close();
}



crazyswede

*** Sent via Developersdex http://www.developersdex.com ***
From: Jeff North on
On 22 Jul 2010 22:27:10 GMT, in comp.lang.javascript Rob Christiansen
<robb_christiansen(a)q.com>
<4c48c5bd$0$2503$815e3792(a)news.qwest.net> wrote:

>| this snippet first checks if the file exists. if it does, it does
>| nothing. if it doesn't exist, it creates it. but my code makes my script
>| crash. please, what am i doing wrong?
>| -------------------------------
>| var filename = filemonth +"-"+ fileday +"-20"+ fileyear +".txt";
>|
>| var abs_path = String(Request.ServerVariables("PATH_TRANSLATED"));
>| //var FileToWorkWith = abs_path.replace(/\\\w*\.asp/,"\\")+ filename;
>| //<- ???
>| fso = new ActiveXObject("Scripting.FileSystemObject");
>|
>| if( !fso.FileExists( filename ) ) //cccccccccccccccc
>| { //aaa
>| fso = Server.CreateObject("Scripting.FileSystemObject")
>| f=fso.CreateTextFile( filename )
>| f.Close
>| } //aaa
>| else
>| {
>| Response.Write( filename +" already exists but will append your new
>| submission. <br>" );
>| fso.close();
>| }

This is MS only code so you should use
<script type="text/VBscript">

You might create the file but nothing is ever written to it (in the
snippet that you gave).

Check of the open file options - I am sure that you can open/append to
a file. The file will also be created if it doesn't already exist.
From: Evertjan. on
Jeff North wrote on 23 jul 2010 in comp.lang.javascript:

>>| Response.Write( filename +" already exists but will append your new
>>| submission. <br>" );
>
> This is MS only code so you should use
> <script type="text/VBscript">

Wrong.
This is ASP-Javascript.
The giveaway is "Response.Write()".
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
From: Jeff North on
On 23 Jul 2010 14:20:43 GMT, in comp.lang.javascript "Evertjan."
<exjxw.hannivoort(a)interxnl.net>
<Xns9DBEA646950BDeejj99(a)194.109.133.242> wrote:

>| Jeff North wrote on 23 jul 2010 in comp.lang.javascript:
>|
>| >>| Response.Write( filename +" already exists but will append your new
>| >>| submission. <br>" );
>| >
>| > This is MS only code so you should use
>| > <script type="text/VBscript">
>|
>| Wrong.
>| This is ASP-Javascript.
>| The giveaway is "Response.Write()".

Well if you really want to get picky its ASP-JScript :-P
From: Evertjan. on
Jeff North wrote on 23 jul 2010 in comp.lang.javascript:

> On 23 Jul 2010 14:20:43 GMT, in comp.lang.javascript "Evertjan."
> <exjxw.hannivoort(a)interxnl.net>
> <Xns9DBEA646950BDeejj99(a)194.109.133.242> wrote:
>
>>| Jeff North wrote on 23 jul 2010 in comp.lang.javascript:
>>|
>>| >>| Response.Write( filename +" already exists but will append your new
>>| >>| submission. <br>" );
>>| >
>>| > This is MS only code so you should use
>>| > <script type="text/VBscript">
>>|
>>| Wrong.
>>| This is ASP-Javascript.
>>| The giveaway is "Response.Write()".
>
> Well if you really want to get picky its ASP-JScript :-P

My "wrong" was not "getting picky" but ment simply,
that you were wrong, completely wrong indeed.

Jscript is just MSish for Javascript, not another language,
so calling it so is not wrong at all.

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)