Wilson WindowWare Tech Support

WinBatch WinBatch+Compiler WebBatch
Home | Tech Database | Tech BBS | White Papers | Purchase


Unicode Conversion with "Scripting.FileSystemObject"

Keywords: 	 Unicode conversions with FileSystemObject

; Read ascii textfile, write back as unicode. 
; Read unicode, write back as ascii.

testfile  = "d:\temp\test.txt" ; asciifile must exist

objFSO    = ObjectOpen("Scripting.FileSystemObject")
objFile   = objFSO.GetFile(testfile)
objStream = objFile.OpenAsTextStream(1,0)  ; read ascii
Buffer    = objStream.Readall()
ObjectClose(objStream)
objStream = objFile.OpenAsTextStream(2,-1) ; write unicode
objStream.Write(Buffer)
ObjectClose(objStream)
ObjectClose(objFile)
ObjectClose(objFSO)
runzoomwait(StrCat(DirHome(),"browser.exe"),testfile)

objFSO    = ObjectOpen("Scripting.FileSystemObject")
objFile   = objFSO.GetFile(testfile)
objStream = objFile.OpenAsTextStream(1,-1) ; read unicode 
Buffer    = objStream.Readall()
ObjectClose(objStream)
objStream = objFile.OpenAsTextStream(2,0)  ; write ascii
objStream.Write(Buffer)
ObjectClose(objStream)
ObjectClose(objFile)
ObjectClose(objFSO)
runzoomwait(StrCat(DirHome(),"browser.exe"),testfile)
exit

Detlev Dalitz
DD.20020704.2319