Reading, Writing & Calling files on Client Side

Posted on 2007-08-06
Last Modified: 2010-04-16
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.
Question by:doyle007
    LVL 9

    Accepted 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

    LVL 9

    Expert Comment

    sorry change this line Wscript.Echo gpsOutStr
    MsgBox gpsOutStr, vbExclamation, "My Project"
    LVL 75

    Expert Comment

    by:Michel Plungjan
    Actually JavaScript can also be used in WSH

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Course: HTML5 for Beginning Beginners

    Are you looking for an efficient introduction to HTML5? Have you tried other HTML5 courses and found them too complex? Do you need just the basics of HTML5 to use with Wordpress or other content management system? If you said yes to any of these questions, this course is for you.

    When you receive another warning that your shared drive is almost full and you have asked your users to clean out old files again and again, here is a single command that may help. This command will place all the files that have not been used rec…
    International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
    This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
    The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

    737 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    21 Experts available now in Live!

    Get 1:1 Help Now