Link to home
Start Free TrialLog in
Avatar of jastroem
jastroem

asked on

Some FrontPage (counter)

Hi
I'm looking for a smart way to inspect some counters from a web site with FpExtensions. I have tryed to "include the cnt file into an HTML file... however this does'nt work. Also try to open that particular cnt file in the web browser does'nt work, even if I set the Netscape options to open the notepad.exe for files with cnt extension.

Also:
Does anyone have experience on running a larger number of counters (more than 100)  with Frontpage? If yes, is working in a proper way?

Cheers
Jörgen Aström
Avatar of TAMC
TAMC

The easiest way to do this would be to use some script, either javascript or vbscript, even better you could write asp, tell me which so I know which to write.
Avatar of jastroem

ASKER

Hi, and thank you for your answer.

Actually it doesn't matter in what way it is done...
What I want is to view just any kind of counter file (simple files only containg a number)
within my browser. If it's a script or an asp solution is not that important.

Please tell me how many points you expect for a "job" like that. And please also tell what you need to know about my server envirments.

Best wishes
jörgen Aström
ASKER CERTIFIED SOLUTION
Avatar of TAMC
TAMC

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Here, this worked on my machine, with IIS 3.0 and ASP installed, if this isn't up to your specs just comment me thanks.

Notes: change the line OpenTestFile("C:\boot.ini") to the path of the cnt file you want to open, also besides ReadAll there is ReadLine, and just Read, if you would rather use those, just comment me again.

<% @ LANGUAGE="VBSCRIPT" %>
<%
 OPTION EXPLICIT
 Dim file,filesystem,text
%>
<HTML>
<HEAD>
</HEAD>
<BODY>
<%
  Set filesystem = CreateObject("Scripting.FileSystemObject")
  Set file = filesystem.OpenTextFile("c:\boot.ini")
  text = file.ReadAll
  file.Close
  Response.Write text
%>
</BODY>
</HTML>
I will try it. Tell me do just have to cut'n paste the code into an html file?
The problem might be the path to the files. Actually this is my main problem in some cgi I'm trying out right now... My server is a virtual server and it's so confusing to find out the proper way to my dierctorys. (it is a NT 4 Server IIS and I should be able to run ASP on it)

Thanks / Jörgen
What is in my answer is a whole file, it will work on its own.  If you want to incorporate it in to your own HTML file do this:

1) Put the following code at the top before anything else, again change boot.ini to the path of your file on the server if its in the same directory you can just put the file name(just like images):
   <% @ LANGUAGE="VBSCRIPT" %>
   <%
    OPTION EXPLICIT
    Dim file,filesystem,text
    Set filesystem = CreateObject ("Scripting.FileSystemObject")
    Set file = filesystem.OpenTextFile("c:\boot.ini")
   %>
2) Put the following code where you want to display the counter information.
   <% text = file.ReadAll
      Response.Write text %>
3) Put this when your done with the counter information
   <% file.Close %>
4) Rename the file to have an .asp extension (otherwise it won't work)
5) Put the file in a directory where you have read and execute rights(Might work in your cgi-bin directory?)
6) Hurray! should work, if not, comment again.

I will try it. Tell me do just have to cut'n paste the code into an html file?
The problem might be the path to the files. Actually this is my main problem in some cgi I'm trying out right now... My server is a virtual server and it's so confusing to find out the proper way to my dierctorys. (it is a NT 4 Server IIS and I should be able to run ASP on it)

Thanks / Jörgen
Huh, your repeating yourself.
I will try it. Tell me do just have to cut'n paste the code into an html file?
The problem might be the path to the files. Actually this is my main problem in some cgi I'm trying out right now... My server is a virtual server and it's so confusing to find out the proper way to my dierctorys. (it is a NT 4 Server IIS and I should be able to run ASP on it)

Thanks / Jörgen
I will try it. Tell me do just have to cut'n paste the code into an html file?
The problem might be the path to the files. Actually this is my main problem in some cgi I'm trying out right now... My server is a virtual server and it's so confusing to find out the proper way to my dierctorys. (it is a NT 4 Server IIS and I should be able to run ASP on it)

Thanks / Jörgen
I'm sorry I thought I could only reload this window to see if there's an "answer" from you.
Please forgive me for your unconvinence...
Here's the result of my tests:

The server returns this (in German)
Laufzeitfehler in Microsoft VBScript-Fehler '800a004c'
Pfad nicht gefunden
/cgi-bin/test.asp, Zeile 6

It says Runtime Error in Microsoft...
path not found
/cgi-bin/test.asp, line6

And here's the asp doc (named test.asp):

<% @ LANGUAGE="VBSCRIPT" %>
<%
           OPTION EXPLICIT
           Dim file,filesystem,text
           Set filesystem = CreateObject ("Scripting.FileSystemObject")
           Set file = filesystem.OpenTextFile("_private/home.htm.cnt")
          %>
<html>

<head>
<title>TEST</title>
</head>

<body>
<% text = file.ReadAll
             Response.Write text %>
<% file.Close %>
</body>
</html>

___________________________

I have put the test.asp into my cgi-bin folder.

Any smart hints?

Thank you in advance
I will get back to you by the time EE says its 5:00 pm.