Tricentis Tosca 16.0 Released on Feb-2023 ----- UFT has been upgraded from UFT 15.0.1 to UFT One 15.0.2, Beginning at November 2020.

Sunday, 31 March 2019

Creating Logifle using VB script

Creating a Text File and Appending Texts in the file Using VB Script.


PublicFunction  updateLogsFile(Information,Message)

strLogFilePath = "\\testFramework\Automation\ProjectSAP\FICO\Log File.txt"
Set fso = CreateObject("Scripting.FileSystemObject")
 Time_Stamp = "| " &now& " | " &Information &" | " &Message & " |"

If fso.FileExists(strLogFilePath) Then
    Set ts = fso.Opentextfile(strLogFilePath,8) 
    ts.WriteLine""&Time_Stamp
Else
    Set Text = fso.CreateTextFile(strLogFilePath)
        Text.WriteLine""&Time_Stamp
EndIf

Set ts = Nothing
Set fso = Nothing

EndFunction




No comments:

Post a Comment

Note: only a member of this blog may post a comment.