JavaScript

Moderators: None (Apply to moderate this forum)
Number of threads: 2058
Number of posts: 5158

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
Doubt Posted by azeem_is on 19 Dec 2002 at 3:02 AM
Hai to all,
My Question is "Can We Modify a Text File in the Hard Disk with the help of Script(it may be any script). If we can, what send me the details." Please answer to my question.

Report
Re: Doubt Posted by gaspard on 19 Dec 2002 at 4:36 PM
: Hai to all,
: My Question is "Can We Modify a Text File in the Hard Disk with the help of Script(it may be any script). If we can, what send me the details." Please answer to my question.
:


JavaScript is protected from modifying hard drive files, but I believe there may be a way to get around it... NOT SURE on that one..

otherwise, an easy way is via a web server, say IIS 5, and running a VB or J script, like:



(VBSCRIPT in ASP)

<%
'How to write to a textfile example
'
'(c) 2001 Programmers Heaven
http://www.programmersheaven.com


const ForAppending=8
const TristateFalse=0

dim f,fsobj,filename

'Create a filesystem object   
Set fsobj = CreateObject("Scripting.FileSystemObject")

'The path and filename to write to
filename="c:\testfile.txt"

'Open the textfile, create a new if it does not already exist
Set f = fsobj.OpenTextFile(filename, ForAppending,true,TristateFalse)

'Write to textfile
f.Writeline "This is a test!"

'Close the file
f.Close

'Free the objects
set f=nothing
set fsobj=nothing
%>






 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.