n=cint(inputbox("Enter the value"))
For i=1 to n
For j=1 to i
c=c+j
If j=i Then
e=e+(c*j)
End If
Next
c=empty
Next
print e
For i=1 to n
For j=1 to i
c=c+j
If j=i Then
e=e+(c*j)
End If
Next
c=empty
Next
print e


| # | Type of Web object | Class Name(micclass) |
| 1 | Web Browser | Browser |
| 2 | Page | Page |
| 3 | Edit box | WebEdit |
| 4 | Image | Image |
| 5 | Link | Link |
| 6 | Web Element | WebElement |
| 7 | Button | WebButton |
| 8 | Checkbox | WebCheckBox |
| 9 | Combobox (DropDownList) | WebList |
| 10 | Table | WebTable |

Enable and Disable OverwritingSet fso=createobject("Scripting.FileSystemObject")
'Create a non existing file "qtptest.txt " with overwrite option as TrueSet qfile1=fso.CreateTextFile("C:\qtptest.txt",True,False)
'Output --> New File "qtptest.txt " is created'Close the filesqfile1.Close'Release the allocated objectsSet qfile1=nothing
'Create a filesystemObjectSet fso=createobject("Scripting.FileSystemObject")
'Create a file "qtptest.txt " in C Drive .
'Then run the below statement with overwrite option as False'Output --> Error message "File already exists" is displayed
Set qfile2=fso.CreateTextFile("C:\qtptest.txt",False,False)
Set fso=nothing
fso: | (Required) The name of a FileSystemObject object previously instantiated. |
source: | (Required) A character string file specification, which can include wildcard characters, for one or more files to be copied. |
destination: | (Required) Character string destination where the file or files from source are to be copied.Wildcard characters are not allowed in the destination string. |
overwrite: | (Optional) Boolean value that indicates if existing files are to be overwritten. If True, files are overwritten; if False, they are not. The default is True. Note that CopyFile will fail if destination has the read-only attribute set, regardless of the value of overwrite. |
Set fso=createobject("Scripting.FileSystemObject")
'File to be copied Sourcefile="C:\copy.txt"'Dest folder where the file has to be copiedDestination="D:\final1\"
'If the destination doesnot exist then create the destination folderIf fso.FolderExists(Destination) = false Then
fso.CreateFolder (Destination)End If
'Copy the file fso.CopyFile Sourcefile,Destination,True
Set fso=nothing
fso: | (Required) The name of a FileSystemObject object previously instantiated |
filename: | (Required) The name of the file to delete. The filename can contain wildcard characters in the last path component. |
force: | (Optional) Boolean value that is True of files with the read-only attribute set are to be deleted;False if they are not. False is the default. |
Set fso=createobject("Scripting.FileSystemObject")
'File to be deleted. Sourcefile="C:\copy.txt" 'Delete the filefso.DeleteFile SourcefileSet fso=nothing
fso: | (Required) The name of a FileSystemObject object previously instantiated. |
foldername: | (Required) A character string expression that identifies the folder to create. |
Set fso=createobject("Scripting.FileSystemObject")
'Folder to be created Foldername="D:\Folder_create"
'If the folder doenot exst then create the folderIf fso.FolderExists(Foldername) = false Then
fso.CreateFolder (Foldername)End If
Set fso=nothing
fso: | (Required) The name of a FileSystemObject object previously instantiated. |
source: | (Required) A character string folder specification, which can include wildcard characters, for one or more folders to be copied. Wildcard characters can only be used in the last path component of the source argument. |
destination: | (Required) Character string destination where the folder and subfolders from source are to be copied. Wildcard characters are not allowed in the destination string. |
overwrite: | (Optional) Boolean value that indicates if existing folders are to be overwritten. If True, files are overwritten; if False, they are not. The default is True. |
Set fso=createobject("Scripting.FileSystemObject")
'Folder to be created SourcePath="D:\Folder_create" DestinationPath="D:\Destination\" 'If the folder doesnot exst then create the folderIf fso.FolderExists(DestinationPath) = false Then
fso.CreateFolder (DestinationPath)End If
fso.CopyFolder SourcePath,DestinationPath,True
Set fso=nothing
fso: | (Required) The name of a FileSystemObject object previously instantiated. |
source: | (Required) The path to the folder or folders to be moved. The source argument string can contain wildcard charactersin the last path component only. |
destination: | (Required) The path where the folder or folders are to be moved. The destination argument can't contain wildcard characters. |
Set fso=createobject("Scripting.FileSystemObject")
'Folder to be created SourcePath="D:\Folder_move" DestinationPath="D:\Destination\" 'If the folder doesnot exst then create the folderIf fso.FolderExists(DestinationPath) = false Then
fso.CreateFolder (DestinationPath)End If
fso.MoveFolder SourcePath,DestinationPathSet fso=nothing
fso: | (Required) The name of a FileSystemObject object previously instantiated |
folderspec: | (Required) The name of the folder to delete. The folderspec can contain wildcard characters in the last path component. |
force: | (Optional) Boolean value that is True of folders with the read-only attribute set are to be deleted;False if they are not. False is the default. |
Set fso=createobject("Scripting.FileSystemObject")
'Folder to be deleted. FolderDel="D:\final1" 'Delete the folderfso.DeleteFolder(FolderDel)Set fso=nothing
fso: | (Required) The name of a FileSystemObject object previously instantiated. |
drivespec: | (Required) A drive letter or a complete path specification. |
Set fso=createobject("Scripting.FileSystemObject")
'The drive to check the existencedrivepath="D:\"
If fso.DriveExists(drivepath) then
msgbox "Drive Exists" Else Msgbox "Drive doesnot Exist"
End If
Set fso=nothing
fso: | (Required) The name of a FileSystemObject object previously instantiated. |
filespec: | (Required) The name of the file whose existence is to be determined. A complete path specification (either absolute or relative) must be provided if the file isn't expected to exist in the current folder. |
Set fso=createobject("Scripting.FileSystemObject")
'The file to check the existencefilepath="D:\qtptest.txt"
If fso.FileExists(filepath) then
msgbox "File Exists"
ElseMsgbox "File doesnot Exist"
End If
Set fso=nothing
fso: | (Required) The name of a FileSystemObject object previously instantiated. |
folderspec: | (Required) The name of the folder whose existence is to be determined. A complete path specification (either absolute or relative) must be provided if the folder isn't expected to exist in the current folder. |
Set fso=createobject("Scripting.FileSystemObject")
'The Folder to check the existencefolderpath="D:\qtp"
If fso.FolderExists(folderpath) then
msgbox "Folder Exists"
ElseMsgbox "Folder doesnot Exist"
End If
Set fso=nothing
fso: | (Required) The name of a FileSystemObject object previously instantiated. |
drivespec: | (Required) The drivespec argument can be a drive letter (c), a drive letter with a colon appended (c:), a drive letter with a colon and path separator appended (c:\), or any network share specification (file://computer2/share1 |
Set fso=createobject("Scripting.FileSystemObject")
'Drive for getting details Sourcefile="C:\" Set get_drv=fso.GetDrive(Sourcefile) 'Some of the following details can be retrieved from a drive
msgbox get_drv.AvailableSpaceMsgbox get_drv.DriveLettermsgbox get_drv.DriveTypemsgbox get_drv.FileSystemmsgbox get_drv.FreeSpacemsgbox get_drv.PathMsgbox get_drv.RootFolderMsgbox get_drv.SerialNumberMsgbox get_drv.TotalSizeSet fso=nothing
fso: | (Required) The name of a FileSystemObject object previously instantiated. |
folderSpec: | (Required) The folderspec is the path (absolute or relative) to a specific folder. |
Set fso=createobject("Scripting.FileSystemObject")
'Folder for getting details Sourcefolder="D:\QTP"
Set get_folder=fso.GetFolder(Sourcefolder)
'get the subfolders count in a folderSet get_subfolder=get_folder.SubFolders
For each sfile in get_subfolder
'Get the name of each folder Msgbox sfile.nameNextSet fso=nothing
fso: | (Required) The name of a FileSystemObject object previously instantiated. |
fileSpec: | (Required) The filespec is the path (absolute or relative) to a specific file. |
Set fso=createobject("Scripting.FileSystemObject")
'File for getting details Sourcefile="D:\qtptest.txt"Set get_file=fso.GetFile(Sourcefile)
'Some of the following details can be retrieved from a filemsgbox get_file.DateCreatedmsgbox get_file.DateLastAccessedmsgbox get_file.DateLastModifiedmsgbox get_file.ParentFoldermsgbox get_file.PathSet fso=nothing
objTso: | (Required) The name of a TextStream Object previously instantiated. |
Set fso=createobject("Scripting.FileSystemObject")
'Open the file "qtptest.txt" in writing mode.
Set qfile=fso.OpenTextFile("C:\qtptest.txt",2,True) 'write contents to the file into a single lineqfile.Write "Welcome to the World of QTP"
qfile.Write "the file name is qtptest.txt"
'Open the file "qtptest.txt" in reading mode. Set qfile=fso.OpenTextFile("C:\qtptest.txt",1,True)
'Read the entire contents of priously written fileDo while qfile.AtEndOfStream <> true
'Output --> The file will contain the above written content in single line.
Msgbox qfile.ReadLine Loop
'Close the filesqfile.Close'Release the allocated objectsSet qfile=nothing
Set fso=nothing
objTso: | (Required) The name of a TextStream Object previously instantiated. |
numCharacters: | (Required) The number of characters you want to read from the file |
Set fso=createobject("Scripting.FileSystemObject")
'Open the file "qtptest.txt" in writing mode.Set qfile=fso.OpenTextFile("C:\qtptest.txt",2,True)
'write contents to the file into two newlinesqfile.Writeline "Welcome to the World of QTP"
qfile.Writeline "the file name is qtptest.txt"
'Open the file "qtptest.txt" in reading mode.Set qfile=fso.OpenTextFile("C:\qtptest.txt",1,True)
'Read characters from the fileMsgbox qfile.Read(10) 'Output --> "Welcome to" will be read
'Close the filesqfile.Close'Release the allocated objectsSet qfile=nothing
Set fso=nothing
objTso: | (Required) The name of a TextStream Object previously instantiated. |
Set fso=createobject("Scripting.FileSystemObject")
'Open the file "qtptest.txt" in writing mode.Set qfile=fso.OpenTextFile("C:\qtptest.txt",2,True)
'write contents to the file into two newlinesqfile.Writeline "Welcome to the World of QTP"
qfile.Writeline "the file name is qtptest.txt"
'Open the file "qtptest.txt" in reading mode.Set qfile=fso.OpenTextFile("C:\qtptest.txt",1,True)
'Read the entire contents of priously written fileMsgbox qfile.ReadAll 'Output --> Displays the entire file.
'Close the filesqfile.Close'Release the allocated objectsSet qfile=nothing
Set fso=nothing
objTso: | (Required) The name of a TextStream Object previously instantiated. |
Set fso=createobject("Scripting.FileSystemObject")
'Open the file "qtptest.txt" in writing mode.Set qfile=fso.OpenTextFile("C:\qtptest.txt",2,True)
'write contents to the file into two newlinesqfile.Writeline "Welcome to the World of QTP"
qfile.Writeline "the file name is qtptest.txt"
'Open the file "qtptest.txt" in reading mode.Set qfile=fso.OpenTextFile("C:\qtptest.txt",1,True)
'Read the entire contents of priously written fileDo while qfile.AtEndOfStream <> true
Msgbox qfile.ReadLine 'Output --> The file will be read line line by line.
Loop
'Close the filesqfile.Close'Release the allocated objectsSet qfile=nothing
Set fso=nothing
objTso: | (Required) The name of a TextStream Object previously instantiated. |
string: | (Required) The text you want to write to the file. |
Set fso=createobject("Scripting.FileSystemObject")
'Open the file "qtptest.txt" in writing mode.Set qfile=fso.OpenTextFile("C:\qtptest.txt",2,True)
'write contents to the file into a single lineqfile.Write "Welcome to the World of QTP"
qfile.Write "the file name is qtptest.txt"
'Open the file "qtptest.txt" in reading mode.Set qfile=fso.OpenTextFile("C:\qtptest.txt",1,True)
'Read the entire contents of priously written fileDo while qfile.AtEndOfStream <> true
'Output --> The file will contain the above written content in single line.
Msgbox qfile.ReadLineLoop
'Close the filesqfile.Close'Release the allocated objectsSet qfile=nothing
Set fso=nothing
objTso: | (Required) The name of a TextStream Object previously instantiated. |
string: | (Optional) The text you want to write to the file. |
Set fso=createobject("Scripting.FileSystemObject")
'Open the file "qtptest.txt" in writing mode.Set qfile=fso.OpenTextFile("C:\qtptest.txt",2,True)
'write contents to the file into two newlinesqfile.Writeline "Welcome to the World of QTP"
qfile.Writeline "the file name is qtptest.txt"
'Open the file "qtptest.txt" in reading mode.Set qfile=fso.OpenTextFile("C:\qtptest.txt",1,True)
'Read the entire contents of priously written fileDo while qfile.AtEndOfStream <> true
'Output --> The file will contain the above written content line by line.
Msgbox qfile.ReadLine Loop
'Close the filesqfile.Close'Release the allocated objectsSet qfile=nothing
Set fso=nothing
objTso: | (Required) The name of a TextStream Object previously instantiated. |
numLines: | (Required) The number of newline characters you want to write to the file. |
Set fso=createobject("Scripting.FileSystemObject")
'Open the file "qtptest.txt" in writing mode.Set qfile=fso.OpenTextFile("C:\qtptest.txt",2,True)
'write contents to the file into two newlinesqfile.Writeline "Welcome to the World of QTP"
'will insert 4 new blank linesqfile.WriteBlankLines(4)qfile.Writeline "the file name is qtptest.txt"
'Open the file "qtptest.txt" in reading mode.Set qfile=fso.OpenTextFile("C:\qtptest.txt",1,True)
'Read the entire contents of priously written fileDo while qfile.AtEndOfStream <> true
'Output --> The file will be read file line by line.
Msgbox qfile.ReadLineLoop
'Close the filesqfile.Close'Release the allocated objectsSet qfile=nothing
Set fso=nothing
objTso: | (Required) The name of a TextStream Object previously instantiated. |
Set fso=createobject("Scripting.FileSystemObject")
'Open the file "qtptest.txt" in writing mode.Set qfile=fso.OpenTextFile("C:\qtptest.txt",2,True)
'write contents to the file into newlineqfile.Writeline "Welcome to the World of QTP"
'Open the file "qtptest.txt" in reading mode.Set qfile=fso.OpenTextFile("C:\qtptest.txt",1,True)
Do while qfile.AtEndOfLine <> true
Msgbox qfile.Read(1) 'Output --> The file will be read word by word.
Loop
'Close the filesqfile.Close'Release the allocated objectsSet qfile=nothing
Set fso=nothing
objTso: | (Required) The name of a TextStream Object previously instantiated. |
Set fso=createobject("Scripting.FileSystemObject")
'Open the file "qtptest.txt" in writing mode.Set qfile=fso.OpenTextFile("C:\qtptest.txt",2,True)
'write contents to the file into two newlinesqfile.Writeline "Welcome to the World of QTP"
qfile.Writeline "the file name is qtptest.txt"
'Open the file "qtptest.txt" in reading mode.Set qfile=fso.OpenTextFile("C:\qtptest.txt",1,True)
'Read the entire contents of previously written fileDo while qfile.AtEndOfStream <> true
Msgbox qfile.ReadLine 'Output --> The file will be read line line by line.
Loop
'Close the filesqfile.Close'Release the allocated objectsSet qfile=nothing
Set fso=nothing