• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 152
  • Last Modified:

Reading, Writing & Calling files on Client Side

What I have at the moment is a HTML page that contains 2 input values and a submit button, hosted on a Windows Server 2003 machine. Once the inputs are entered and the button is clicked, those 2 inputs are used as part of a string, which is as input into a .INI file (Client Side). This .INI file is then used in a batch file (also Client Side) that I would like to call. How can I go about reading/writing the .INI files and calling the .BAT files that are located on the client?

This service will only be used through Internet Explorer, so browser compatibility isn't an issue.
  • 2
1 Solution
you can access files only in IE using VBSCRIPT. not in other browsers.

For reading the file
Option Explicit
'on Error Resume Next
Dim gpsFile
Dim gpsFileLines
Dim gpsLineCnt
Dim gpsOutStr
Dim eGpsLine

Dim oFSO : Set oFSO = CreateObject("Scripting.FileSystemObject")
Dim oWS : Set oWS = CreateObject("WScript.Shell")
gpsFile = "c:\my.ini"

If oFSO.FileExists(gpsFile) Then
  With oFSO.GetFile(gpsFile)
    gpsFileLines = Split(.OpenAsTextStream(1, 0).Read(.Size), vbcrlf)
  End With

  gpsLineCnt = 0
  For Each eGpsLine in gpsFileLines
        If gpsLineCnt > 8 Then
            gpsOutStr = gpsOutStr & eGpsLine & vbcrlf
        End if
        gpsLineCnt = gpsLineCnt + 1
  If gpsLineCnt = 0 Then
        MsgBox "File is Empty", vbExclamation, "My Project"
        Wscript.Echo gpsOutStr
  End If
  MsgBox "Cannot read the File", vbExclamation, "My Project"
End If

sorry change this line Wscript.Echo gpsOutStr
MsgBox gpsOutStr, vbExclamation, "My Project"
Michel PlungjanIT ExpertCommented:
Actually JavaScript can also be used in WSH

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now