Char counterCount real characters in a file
File Name : charcount.vbs Requirement : none Author : Jean-Luc Antoine Submitted : 01/09/2001 Category : Other Dim f, a, s, n, x, p set p = wscript.arguments If p.Count Then s = p.item(0) Else s = InputBox("Enter the filename to scan") If s = "" Then WScript.Quit(1) End If Set f = CreateObject("Scripting.FileSystemObject") If Not f.FileExists(s) Then MsgBox "File Not Found : " & s, 16 WScript.Quit(2) End If Set a = f.OpenTextFile(s, 1) n = 0 While Not a.AtEndOfStream s = a.ReadLine For x = 1 To Len(s) n = n - (Asc(Mid(s,x,1)) > 32) Next Wend a.Close MsgBox "Number of characters : " & n, 64 |
|||||
![]()
|
|