Like us on Facebook

Showing posts with label File and FileSystemObject. Show all posts
Showing posts with label File and FileSystemObject. Show all posts

February 8, 2015

How to Open/Read/Write/Appened a File through FileSystemObject using VB Script

February 8, 2015
We shall use File System object to open a File and read its content through 'Read','ReadAll'
and  'ReadLine' methods of a File, opened in Reading mode.
We can open a file in three different mode for reading ,writing and appending.Const is a reserved
keyword in VB Script which is used to declare constant variables in script.OpenTextFile 
is method of FileSystemObject which is used to open files.

1.'Example of Read method of File object, Read Method takes parameter as number of
specified characters that should be read

FileSystemObject(UFT/QTP):Access File through VB Script


'##################################################################
'Working with Files through FileSystemObject in VB Script  for QTP/UFT
'Author: Vikas
'##################################################################
'1.Working with Files in VB Script

'1.1 How to create a text file  in QTP/UFTusing VB Script(Visual Basic Script) ?

Dim objFso,objFile
Set objFso=CreateObject("Scripting.FileSystemObject")' Fso object can be used to 
operate over both Files and Folder
'CreateTextFile method of File object creates a new  text file ,other parameter "True"
 is used to overwrite the exisitng file having same name
Set objFile=objFso.CreateTextFile( "D:\Music\myTextFile.txt",true)
'Output :

.
© 2014-2015 Informational Digit : How-To & Tech Guides. The content is copyrighted to Vikas Pandey and may not be reproduced on other websites. WP themonic converted by Bloggertheme9.
TOP