Solved

VBScript Question

Posted on 2004-08-11
4
213 Views
Last Modified: 2012-05-05
Someone please tell me why this script never exits the Loop PLEASE!

On Error Resume Next

Const ForReading = 1, ForWriting = 2, ForAppending = 8

Dim fso, f, s

Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.OpenTextFile("c:\testfile.txt", ForReading, True)
Do While NOT f.AtEndOfStream
   s = f.readline
   wscript.Echo s
   f.Close
Loop
0
Comment
Question by:Packerland
  • 2
4 Comments
 
LVL 2

Accepted Solution

by:
KJHDI12 earned 500 total points
ID: 11773535

f.Close

should be afte

Loopr
0
 
LVL 9

Expert Comment

by:_ys_
ID: 11773540
Swap the last two lines:

Loop
f.Close
0
 
LVL 26

Expert Comment

by:EDDYKT
ID: 11774050
Also change ForReading to 1
0
 
LVL 26

Expert Comment

by:EDDYKT
ID: 11774064
never mind
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Windows 10 start screen issues 9 55
MsgBox 2 59
how can i unlock a picture file that was loaded in a picturebox in visual c#? 4 104
MS Date Picker 64 bit 32 bit issue 12 59
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

791 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