Below is the vbscript code that can be used to check if the file exists on system or not
'In below examples: path is the path of file like "c:\text.txt"
Sub Main
set fs=createObject("Scripting.FileSystemObject")
If not fs.FileExists(path) Then
Log.Message("Fail: file does not exist")
Else
Log.Message("Pass: File exists")
End If
End Sub
Below is the code to delete a file
Sub Delete
set fs=createObject("Scripting.FileSystemObject")
If not fs.FileExists(path) Then
Else
fs.deletefile(path)
End If
End sub
Good work dude
ReplyDeleteHi
ReplyDeleteI want to know how to extract the test script name currently executing.
Project["TestItems"]["Current"].Name property gives an error as "Object required".
please help me on this or please provide some other solution to grab currently running test script name.
i am using testcomplete 6.0 version
Thanks
Nivedita
Fyi, these have been in TC for awhile now:
ReplyDeleteaqFile.Delete();
aqFile.Exists();
aqFile is a new object available in TC v7.x