Home | Advertising Info13 USERS CURRENTLY ONLINE   
PowerASP
   Site Search Contact Us Thursday, January 16, 2025  

  Active InfoActive Info  Display List of Info MembersMemberlist  Search The InfoSearch  HelpHelp
  RegisterRegister  LoginLogin
Classic ASP - General
 PowerASP Code Help Area : Classic ASP - General
Subject Info: textfile(read,display,delete) A d d  -  P o s tAdd P o s t
Author
Message << Prev Info | Next Info >>
ol4pr0
Newbie
Newbie
Avatar

Joined: July/06/2004
Location: Ecuador
Online Status: Offline
Info: 5
Added: July/06/2004 at 4:32pm | IP Logged Quote ol4pr0

The following code only seems to return that the file does not exists.

if i take out the if exist part it tell me the following
Quote:

RuntimeError Microsoft VBScript (0x800A01B6)
This method is not supported by this object: 'Delete'
line 16
Code:
  <%
Dim filename, content
filename = "textfile.txt"

Set fs=Server.CreateObject("Scripting.FileSystemObject")


If fs.FileExists(filename)=true Then

Set f=fs.OpenTextFile(Server.MapPath(filename), 1)

do while f.AtEndOfStream = false
content = content & f.ReadLine & ""
loop

Response.Write(content)

f.Close
f.Delete
Set f=nothing
Set fs=nothing

else
response.write "No such file or directory!"
Set fs=nothing
end if
%>
Back to Top View ol4pr0's Profile Search for other info by ol4pr0
 
cwilliams
Admin Group
Admin Group
Avatar

Joined: April/26/2004
Location: United States
Online Status: Offline
Info: 137
Added: July/06/2004 at 7:44pm | IP Logged Quote cwilliams

Thats not really valid code.

I'll post something when I have time unless some helpful person beats me to it.



Edited by cwilliams on April/12/2005 at 9:33am


__________________


Chris Williams
http://www.PowerASP.com
Back to Top View cwilliams's Profile Search for other info by cwilliams
 
ol4pr0
Newbie
Newbie
Avatar

Joined: July/06/2004
Location: Ecuador
Online Status: Offline
Info: 5
Added: July/06/2004 at 10:05pm | IP Logged Quote ol4pr0

wondering howcome this is not a valid code and ofcourse what is, also how would i write this as a ActiveX


Edited by ol4pr0 on July/07/2004 at 12:59am
Back to Top View ol4pr0's Profile Search for other info by ol4pr0
 
ol4pr0
Newbie
Newbie
Avatar

Joined: July/06/2004
Location: Ecuador
Online Status: Offline
Info: 5
Added: July/07/2004 at 4:44pm | IP Logged Quote ol4pr0

Oke i got that one working, basicly as it is just added the path.

Now it returning a long long long list of data, so i kinda would like to have it read back into an array. Also how would i make it listen to com ports so i can directly get the information from the com port.

Lets say a person would klik on a button. Com1 -> now it would listen to com1 only
button com2-> listen to data incoming from com2

Any help is nicely appriciated
Back to Top View ol4pr0's Profile Search for other info by ol4pr0
 
cwilliams
Admin Group
Admin Group
Avatar

Joined: April/26/2004
Location: United States
Online Status: Offline
Info: 137
Added: July/08/2004 at 7:06pm | IP Logged Quote cwilliams

I dont think com ports and ASP is going to get you anywhere.

ASP is server side code run through a web browser. The web browser doesn't let any code do anything to the clients machine.

 

So accessing a com port is not really something you would do with a technology like Active Server Pages. It's more along the lines of something you would do with a programming language like Visual Basic or C++   etc etc



__________________


Chris Williams
http://www.PowerASP.com
Back to Top View cwilliams's Profile Search for other info by cwilliams
 
ol4pr0
Newbie
Newbie
Avatar

Joined: July/06/2004
Location: Ecuador
Online Status: Offline
Info: 5
Added: July/08/2004 at 11:52pm | IP Logged Quote ol4pr0

Thank you for that information, oke the following code ( maby not valid as you say, maby when you got time you want to show me the valid version. )

however still wondering how to turn this into a ActiveX code.

Code:

<% @Language = "VBScript" %>
<% Response.buffer = true %>
<%
Dim filename, content
filename = "mytext.txt"
 
Set fs = Server.CreateObject("Scripting.FileSystemObject")
path = Server.MapPath(filename)

If(fs.FileExists(path)) Then
   Set f=fs.OpenTextFile(path, 1)
 
   do while f.AtEndOfStream = false
      content = content & f.ReadLine & vbCrLf & "<BR>"
   loop
 
   Response.Write(content)
 
   f.Close

   'Delete permission fout...
   fs.DeleteFile(path)
 
   Set f=nothing
   Set fs=nothing
Else
   Response.write("File doesn't exist")
End If
%>

Back to Top View ol4pr0's Profile Search for other info by ol4pr0
 

Page of 2 Next >>
  A d d  -  P o s tAdd P o s t
Printable version Printable version

Info Jump
You cannot add new info in this area
You cannot add to info in this area
You cannot delete your info in this area
You cannot edit your info in this area
You cannot create polls in this area
You cannot vote in polls in this area

   Active Server Pages Rule The World
Contact Us  
All artwork, design & content contained in this site are Copyright © 1998 - 2025 PowerASP.com and Christopher J. Williams
Banner ads ,other site logos, etc are copyright of their respective companies.
STATS Unless otherwise noted - All Rights Reserved.

vbscript active server pages ASP vbscript SQL database informix oracle SQL Server Perl CGI Delphi PHP source code code sample samples program CJWSoft ASPProtect ASPBanner ASPClassifieds www.aspprotect.com, www.cjwsoft.com,www.aspclassifieds.com,www.aspphotogallery.com