Working with text files

FileSystemobject



**********************************************************************************

FileSystemobject

**********************************************************************************



As part of our automation Some times we need to interact with text files,folders & Drives,these we can done using filesystemobject



**********************************************************************************

CreateTextFile:

**********************************************************************************

Description :We can create the new file



Syntax:

Set FSO = createobject("scripting.filesystemobject")

set Fpt = FSO.CreateTextFile(Pathoftextfile)



**********************************************************************************

OpenTextFile:

**********************************************************************************



Description : We can call the Existing file



Syntax:

Set FSO = createobject("scripting.filesystemobject")

set Fpt = FSO.OpenTextFile(Pathoftextfile)



**********************************************************************************

Read all :

**********************************************************************************

Description :Usign readall we can read the all data from the text file



Syntax:

Set FSO = createobject("scripting.filesystemobject")

set Fpt = FSO.CreateTextFile(Pathoftextfile)

Fpt.Readall



**********************************************************************************

Readline :

**********************************************************************************

Description : Using readline we can read the line from the text file



Syntax:

Set FSO = createobject("scripting.filesystemobject")

set Fpt = FSO.CreateTextFile(Pathoftextfile)

Fpt.Readline



**********************************************************************************

WriteLine :

**********************************************************************************

Description : Using WriteLine we can write the data to text file

Syntax:=

Set FSO = createobject("scripting.filesystemobject")

set Fpt = FSO.OpenTextFile(PathOfTextFile)

Fpt.WriteLine "QTP"



**********************************************************************************

Below are the some more methods to work with text files & folders

**********************************************************************************

No comments:

Post a Comment